Fix integrate test at release workflow (#352) #247
This file contains 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 | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
draft_release: | |
runs-on: ubuntu-latest | |
outputs: | |
tag_name: ${{ steps.release-drafter.outputs.tag_name }} | |
steps: | |
# Get next version | |
- uses: release-drafter/release-drafter@v6 | |
id: release-drafter | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
runs-on: ubuntu-latest | |
environment: | |
name: prod | |
url: https://www.npmjs.com/package/junit2json | |
permissions: | |
contents: write | |
id-token: write | |
needs: draft_release | |
if: github.event_name == 'workflow_dispatch' | |
steps: | |
# Create version string from tag (v1.0.0 -> 1.0.0) | |
- name: Create version string | |
run: | | |
export TAG_NAME=${{ needs.draft_release.outputs.tag_name }} | |
echo "VERSION=${TAG_NAME:1}" >> $GITHUB_ENV | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '22.x' | |
registry-url: 'https://registry.npmjs.org' | |
- uses: earthly/[email protected] | |
with: | |
version: latest | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
# Use GitHub App for bypassing ruleset guard when git push by npm publish | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.BYPASS_APP_ID }} | |
private-key: ${{ secrets.BYPASS_APP_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
ref: master | |
token: ${{ steps.app-token.outputs.token }} | |
- name: Setup git config | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
# npm publish and push updated package.json | |
- name: Publish to npm and jsr | |
run: | | |
npm run release -- --VERSION=$VERSION | |
git push origin master | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
# Publish github releases. Also tag will be created. | |
- uses: release-drafter/release-drafter@v6 | |
with: | |
publish: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |