Release #32
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: Release | |
| run-name: >- | |
| ${{ inputs.dry_run && 'Release dry-run' || 'Release' }} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Release version, e.g. 1.2.3 (blank = auto-bump the latest tag)" | |
| required: false | |
| default: "" | |
| type: string | |
| bump: | |
| description: "Bump level when version is blank" | |
| required: false | |
| default: patch | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| dry_run: | |
| description: "Dry run: build and validate only" | |
| required: true | |
| default: false | |
| type: boolean | |
| resume_existing_npm: | |
| description: "Skip already-published matching package versions" | |
| required: true | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| validate_dispatch: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| version: ${{ steps.resolve.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.sha }} | |
| - name: Resolve release version | |
| id: resolve | |
| env: | |
| VERSION_INPUT: ${{ inputs.version }} | |
| BUMP: ${{ inputs.bump }} | |
| run: node .github/scripts/release-workflow.js resolve-version | |
| - name: Validate release dispatch | |
| env: | |
| VERSION_INPUT: ${{ steps.resolve.outputs.version }} | |
| DRY_RUN: ${{ inputs.dry_run }} | |
| RESUME_EXISTING_NPM: ${{ inputs.resume_existing_npm }} | |
| run: node .github/scripts/release-workflow.js assert-dispatch-checkout | |
| tag_and_dispatch: | |
| needs: validate_dispatch | |
| if: >- | |
| ${{ | |
| !inputs.dry_run && | |
| !inputs.resume_existing_npm && | |
| github.ref == 'refs/heads/main' | |
| }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: write | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.sha }} | |
| - name: Create tag and dispatch release run | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| VERSION_INPUT: ${{ needs.validate_dispatch.outputs.version }} | |
| DRY_RUN: ${{ inputs.dry_run }} | |
| RESUME_EXISTING_NPM: ${{ inputs.resume_existing_npm }} | |
| run: node .github/scripts/release-workflow.js tag-and-dispatch | |
| dry-run: | |
| needs: validate_dispatch | |
| if: ${{ inputs.dry_run }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.sha }} | |
| - name: Assert checkout ref | |
| env: | |
| VERSION_INPUT: ${{ needs.validate_dispatch.outputs.version }} | |
| DRY_RUN: ${{ inputs.dry_run }} | |
| RESUME_EXISTING_NPM: ${{ inputs.resume_existing_npm }} | |
| run: node .github/scripts/release-workflow.js assert-dispatch-checkout | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org | |
| scope: "@customerio" | |
| - name: Test | |
| run: go test ./... | |
| - uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1 | |
| with: | |
| version: "~> v2" | |
| args: release --clean --snapshot --skip=publish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: goreleaser-dist | |
| path: dist/ | |
| - name: Prepare npm packages | |
| env: | |
| VERSION: ${{ needs.validate_dispatch.outputs.version }} | |
| run: node .github/scripts/prepare-npm-packages.js --pack-dry-run | |
| - name: Validate package metadata | |
| env: | |
| VERSION: ${{ needs.validate_dispatch.outputs.version }} | |
| run: node .github/scripts/publish-packages.js --check | |
| - name: Validate npm publish command | |
| env: | |
| VERSION: ${{ needs.validate_dispatch.outputs.version }} | |
| run: node .github/scripts/publish-packages.js --dry-run | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 24 | |
| registry-url: https://npm.pkg.github.com | |
| scope: "@customerio" | |
| - name: Validate GitHub Packages publish command | |
| env: | |
| VERSION: ${{ needs.validate_dispatch.outputs.version }} | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: node .github/scripts/publish-packages.js --registry=github-packages --dry-run | |
| github_release: | |
| needs: validate_dispatch | |
| if: >- | |
| ${{ | |
| always() && | |
| needs.validate_dispatch.result == 'success' && | |
| !inputs.dry_run && | |
| !inputs.resume_existing_npm && | |
| startsWith(github.ref, 'refs/tags/') | |
| }} | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.sha }} | |
| - name: Assert checkout and tag ref | |
| env: | |
| VERSION_INPUT: ${{ inputs.version }} | |
| DRY_RUN: ${{ inputs.dry_run }} | |
| RESUME_EXISTING_NPM: ${{ inputs.resume_existing_npm }} | |
| run: node .github/scripts/release-workflow.js assert-tag-run | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Test | |
| run: go test ./... | |
| - uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1 | |
| with: | |
| version: "~> v2" | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: goreleaser-dist | |
| path: dist/ | |
| npm_resume_build: | |
| needs: validate_dispatch | |
| if: ${{ !inputs.dry_run && inputs.resume_existing_npm }} | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.sha }} | |
| - name: Assert checkout and tag ref | |
| env: | |
| VERSION_INPUT: ${{ inputs.version }} | |
| DRY_RUN: ${{ inputs.dry_run }} | |
| RESUME_EXISTING_NPM: ${{ inputs.resume_existing_npm }} | |
| run: node .github/scripts/release-workflow.js assert-tag-run | |
| - name: Assert GitHub Release already exists | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| VERSION_INPUT: ${{ inputs.version }} | |
| DRY_RUN: ${{ inputs.dry_run }} | |
| RESUME_EXISTING_NPM: ${{ inputs.resume_existing_npm }} | |
| run: node .github/scripts/release-workflow.js assert-existing-release | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Test | |
| run: go test ./... | |
| - uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1 | |
| with: | |
| version: "~> v2" | |
| args: release --clean --skip=publish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: goreleaser-dist | |
| path: dist/ | |
| npm_publish: | |
| needs: | |
| - github_release | |
| - npm_resume_build | |
| if: >- | |
| ${{ | |
| always() && | |
| !inputs.dry_run && | |
| ( | |
| needs.github_release.result == 'success' || | |
| needs.npm_resume_build.result == 'success' | |
| ) | |
| }} | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.sha }} | |
| - name: Assert checkout and tag ref | |
| env: | |
| VERSION_INPUT: ${{ inputs.version }} | |
| DRY_RUN: ${{ inputs.dry_run }} | |
| RESUME_EXISTING_NPM: ${{ inputs.resume_existing_npm }} | |
| run: node .github/scripts/release-workflow.js assert-tag-run | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org | |
| scope: "@customerio" | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: goreleaser-dist | |
| path: dist/ | |
| - name: Prepare npm packages | |
| env: | |
| VERSION: ${{ inputs.version }} | |
| run: node .github/scripts/prepare-npm-packages.js | |
| - name: Publish npm packages | |
| env: | |
| VERSION: ${{ inputs.version }} | |
| RESUME_EXISTING_NPM: ${{ inputs.resume_existing_npm }} | |
| run: | | |
| args=() | |
| if [[ "$RESUME_EXISTING_NPM" == "true" ]]; then | |
| args+=(--resume-existing) | |
| fi | |
| node .github/scripts/publish-packages.js "${args[@]}" | |
| github_packages_publish: | |
| needs: npm_publish | |
| if: >- | |
| ${{ | |
| always() && | |
| !inputs.dry_run && | |
| needs.npm_publish.result == 'success' | |
| }} | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.sha }} | |
| - name: Assert checkout and tag ref | |
| env: | |
| VERSION_INPUT: ${{ inputs.version }} | |
| DRY_RUN: ${{ inputs.dry_run }} | |
| RESUME_EXISTING_NPM: ${{ inputs.resume_existing_npm }} | |
| run: node .github/scripts/release-workflow.js assert-tag-run | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 24 | |
| registry-url: https://npm.pkg.github.com | |
| scope: "@customerio" | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: goreleaser-dist | |
| path: dist/ | |
| - name: Prepare npm packages | |
| env: | |
| VERSION: ${{ inputs.version }} | |
| run: node .github/scripts/prepare-npm-packages.js | |
| - name: Publish GitHub Packages | |
| env: | |
| VERSION: ${{ inputs.version }} | |
| RESUME_EXISTING_NPM: ${{ inputs.resume_existing_npm }} | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| args=(--registry=github-packages) | |
| if [[ "$RESUME_EXISTING_NPM" == "true" ]]; then | |
| args+=(--resume-existing) | |
| fi | |
| node .github/scripts/publish-packages.js "${args[@]}" |