|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 8 * * *' # Every day at 08:00 UTC |
| 6 | + workflow_dispatch: |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - 'v*' |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: release |
| 13 | + cancel-in-progress: false |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: write |
| 17 | + |
| 18 | +jobs: |
| 19 | + release: |
| 20 | + name: Release |
| 21 | + if: github.event_name != 'push' |
| 22 | + runs-on: ubuntu-latest |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v5 |
| 27 | + with: |
| 28 | + fetch-depth: 0 |
| 29 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + |
| 31 | + - name: Setup Node |
| 32 | + uses: actions/setup-node@v4 |
| 33 | + with: |
| 34 | + cache: npm |
| 35 | + |
| 36 | + - name: Install dependencies |
| 37 | + run: npm ci |
| 38 | + |
| 39 | + - name: Configure git |
| 40 | + run: | |
| 41 | + git config user.name "github-actions[bot]" |
| 42 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 43 | +
|
| 44 | + - name: Bump version, update changelog, and tag |
| 45 | + run: | |
| 46 | + BEFORE=$(node -p "require('./package.json').version") |
| 47 | + npx --yes commit-and-tag-version |
| 48 | + AFTER=$(node -p "require('./package.json').version") |
| 49 | +
|
| 50 | + if [ "$BEFORE" != "$AFTER" ]; then |
| 51 | + git push --follow-tags origin main |
| 52 | + else |
| 53 | + echo "No releasable commits — skipping push" |
| 54 | + fi |
| 55 | +
|
| 56 | + build: |
| 57 | + name: Build |
| 58 | + if: startsWith(github.ref, 'refs/tags/v') |
| 59 | + runs-on: ubuntu-latest |
| 60 | + outputs: |
| 61 | + version: ${{ steps.version.outputs.version }} |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Checkout |
| 65 | + uses: actions/checkout@v5 |
| 66 | + |
| 67 | + - name: Setup Node |
| 68 | + uses: actions/setup-node@v4 |
| 69 | + with: |
| 70 | + cache: npm |
| 71 | + |
| 72 | + - name: Install dependencies |
| 73 | + run: npm ci |
| 74 | + |
| 75 | + - name: Get version from tag |
| 76 | + id: version |
| 77 | + run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" |
| 78 | + |
| 79 | + - name: Build VSIX |
| 80 | + run: npx vsce package |
| 81 | + env: |
| 82 | + LOCALSTACK_WEB_AUTH_REDIRECT: https://app.localstack.cloud/redirect |
| 83 | + NODE_ENV: production |
| 84 | + ANALYTICS_API_URL: https://analytics.localstack.cloud/v1/events |
| 85 | + |
| 86 | + - name: Upload VSIX artifact |
| 87 | + uses: actions/upload-artifact@v4 |
| 88 | + with: |
| 89 | + name: vsix |
| 90 | + path: "*.vsix" |
| 91 | + |
| 92 | + - name: Create GitHub Release |
| 93 | + uses: softprops/action-gh-release@v2 |
| 94 | + with: |
| 95 | + tag_name: ${{ github.ref_name }} |
| 96 | + generate_release_notes: true |
| 97 | + files: "*.vsix" |
| 98 | + |
| 99 | + publish-vscode-marketplace: |
| 100 | + name: Publish to VS Marketplace |
| 101 | + runs-on: ubuntu-latest |
| 102 | + needs: build |
| 103 | + |
| 104 | + steps: |
| 105 | + - name: Download VSIX |
| 106 | + uses: actions/download-artifact@v4 |
| 107 | + with: |
| 108 | + name: vsix |
| 109 | + |
| 110 | + - name: Setup Node |
| 111 | + uses: actions/setup-node@v4 |
| 112 | + |
| 113 | + - name: Publish to VS Marketplace |
| 114 | + run: npx @vscode/vsce publish --packagePath localstack-${{ needs.build.outputs.version }}.vsix |
| 115 | + env: |
| 116 | + VSCE_PAT: ${{ secrets.VSCE_PAT }} |
| 117 | + |
| 118 | + publish-ovsx: |
| 119 | + name: Publish to Open VSX |
| 120 | + runs-on: ubuntu-latest |
| 121 | + needs: build |
| 122 | + |
| 123 | + steps: |
| 124 | + - name: Download VSIX |
| 125 | + uses: actions/download-artifact@v4 |
| 126 | + with: |
| 127 | + name: vsix |
| 128 | + |
| 129 | + - name: Setup Node |
| 130 | + uses: actions/setup-node@v4 |
| 131 | + |
| 132 | + - name: Publish to Open VSX |
| 133 | + run: npx ovsx publish localstack-${{ needs.build.outputs.version }}.vsix -p $OVSX_PAT |
| 134 | + env: |
| 135 | + OVSX_PAT: ${{ secrets.OVSX_PAT }} |
0 commit comments