2.0.0 #45
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 | |
| on: | |
| push: | |
| branches: [main, dev] | |
| tags: [v*] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| - run: sudo apt-get install -y git-crypt | |
| - run: npm ci | |
| - run: npm run build | |
| - run: npm test | |
| publish: | |
| needs: test | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Verify tag is on main | |
| run: | | |
| if ! git branch -r --contains "$GITHUB_SHA" | grep -q 'origin/main'; then | |
| echo "Error: tag $GITHUB_REF_NAME is not on the main branch" | |
| exit 1 | |
| fi | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| - run: npm ci | |
| - name: Verify tag matches package.json version | |
| run: | | |
| PKG_VERSION="v$(node -p 'require("./package.json").version')" | |
| if [ "$PKG_VERSION" != "$GITHUB_REF_NAME" ]; then | |
| echo "Error: tag $GITHUB_REF_NAME does not match package.json version $PKG_VERSION" | |
| exit 1 | |
| fi | |
| - run: npm run package | |
| - name: Create or update GitHub release | |
| run: | | |
| gh release create "$GITHUB_REF_NAME" git-crypt-vscode-*.vsix --title "$GITHUB_REF_NAME" --generate-notes || | |
| gh release upload "$GITHUB_REF_NAME" git-crypt-vscode-*.vsix --clobber | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - run: npm run publish | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} |