feat: add GitHub Actions CI/CD workflow with tests and automatic rele… #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Zsh | |
| run: sudo apt-get update && sudo apt-get install -y zsh | |
| - name: Install Oh My Zsh | |
| run: | | |
| sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended | |
| - name: Setup plugin | |
| run: | | |
| mkdir -p ~/.oh-my-zsh/custom/plugins/venvswitch | |
| cp venvswitch.plugin.zsh ~/.oh-my-zsh/custom/plugins/venvswitch/ | |
| echo 'plugins=(venvswitch)' >> ~/.zshrc | |
| - name: Check syntax | |
| run: zsh -n venvswitch.plugin.zsh | |
| - name: Test basic functionality | |
| run: | | |
| zsh -c 'source ~/.zshrc && venvswitch_config' | |
| - name: Install shellcheck | |
| run: sudo apt-get install -y shellcheck | |
| - name: Lint with shellcheck | |
| run: shellcheck venvswitch.plugin.zsh | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |