Manual Release #24
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: Manual Release Test Workflow | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump: | |
| description: 'Version bump type (used if release_version is empty)' | |
| type: choice | |
| options: | |
| - major | |
| - minor | |
| - patch | |
| - prerelease | |
| required: false | |
| release_version: | |
| description: 'Semver version to release (must be > current root version)' | |
| required: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| packages: write | |
| jobs: | |
| release: | |
| # Allow only on master, spring*, summer*, winter*; | |
| environment: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.WORKFLOW_PAT }} | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Resolve version input | |
| id: resolve_version | |
| run: | | |
| RELEASE_VERSION='${{ inputs.release_version }}' | |
| if [ -z "$RELEASE_VERSION" ]; then | |
| RELEASE_VERSION='${{ inputs.bump }}' | |
| fi | |
| echo "resolved=$RELEASE_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Bump versions (no push) | |
| env: | |
| INPUT_VERSION: ${{ steps.resolve_version.outputs.resolved }} | |
| run: | | |
| node ./scripts/release/version.js "$INPUT_VERSION" | |
| RESOLVED_VERSION=$(jq -r .version package.json) | |
| echo "RESOLVED_VERSION=$RESOLVED_VERSION" >> "$GITHUB_ENV" | |
| - name: Set git identity (Actions bot) | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Sanity check PAT identity | |
| env: | |
| WORKFLOW_PAT: ${{ secrets.WORKFLOW_PAT }} | |
| run: | | |
| curl -sSf -H "Authorization: Bearer $WORKFLOW_PAT" https://api.github.com/user | jq -r .login | |
| - name: Set remote to use PAT | |
| env: | |
| WORKFLOW_PAT: ${{ secrets.WORKFLOW_PAT }} | |
| run: | | |
| git remote set-url origin "https://x-access-token:${WORKFLOW_PAT}@github.com/${{ github.repository }}.git" | |
| git ls-remote origin 1>/dev/null | |
| - name: Commit and push | |
| run: | | |
| git add -A | |
| git commit -m "chore: release v${RESOLVED_VERSION}" | |
| git push origin "HEAD:${GITHUB_REF_NAME}" | |
| # - name: Bump versions and commit | |
| # env: | |
| # INPUT_VERSION: ${{ steps.resolve_version.outputs.resolved }} | |
| # run: | | |
| # git config user.name "github-actions[bot]" | |
| # git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| # node ./scripts/release/version.js "$INPUT_VERSION" | |
| # RESOLVED_VERSION=$(jq -r .version package.json) | |
| # git commit -am "chore: release v$RESOLVED_VERSION" | |
| # git push origin HEAD | |
| # - name: Build | |
| # run: yarn build | |
| # - name: Tag and create GitHub release | |
| # env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # run: | | |
| # VERSION=$(jq -r .version package.json) | |
| # git tag -a "v$VERSION" -m "Release v$VERSION" | |
| # git push origin tag "v$VERSION" | |
| # gh release create "v$VERSION" --title "v$VERSION" --generate-notes | |
| # - name: Publish to npm | |
| # env: | |
| # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| # NPM_CONFIG_ALWAYS_AUTH: 'true' | |
| # run: | | |
| # # Force both npm and yarn to use npmjs and pick up the token | |
| # yarn config set registry https://registry.npmjs.org | |
| # npm config set registry https://registry.npmjs.org | |
| # printf "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}\nalways-auth=true\n" > ~/.npmrc | |
| # # Sanity checks | |
| # echo "yarn registry: $(yarn config get registry)" | |
| # echo "npm registry: $(npm config get registry)" | |
| # TAG=$([ "$GITHUB_REF_NAME" = "master" ] && echo latest || echo "$GITHUB_REF_NAME") | |
| # yarn nx release publish --yes --tag "$TAG" |