fix: use upload-artifact@v5 instead of v2 (#311) #59
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
| # yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json | |
| --- | |
| name: Publish | |
| on: | |
| workflow_dispatch: | |
| workflow_run: | |
| workflows: ["Release"] | |
| types: | |
| - completed | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| id-token: write | |
| actions: read | |
| jobs: | |
| publish-ea: | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| name: Publish EA release to NPM | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| fetch-depth: 0 | |
| - name: Install node 24 | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Configure git | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| - name: Reset to commit | |
| run: | | |
| git reset --hard ${{ github.sha }} | |
| - name: Get current version | |
| id: current-version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| # Remove both -ea. and -ea- formats for compatibility | |
| BASE_VERSION=$(echo "$VERSION" | sed -E 's/-ea[.-][0-9]+$//') | |
| echo "base-version=$BASE_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Install project modules | |
| run: npm ci | |
| - name: Compile project | |
| run: npm run compile | |
| - name: Publish package | |
| run: | | |
| SHORT_SHA=$(git rev-parse --short "${{ github.sha }}") | |
| EA_VERSION="${{ steps.current-version.outputs.base-version }}-ea.${SHORT_SHA}" | |
| npm version "$EA_VERSION" --no-git-tag-version | |
| npm publish --verbose --tag ea --access public --provenance | |
| publish-release: | |
| if: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| name: Publish release to NPM | |
| steps: | |
| - name: Get releasebranch.txt artifact from Release pipeline | |
| if: github.event_name == 'workflow_run' | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: releasebranch.txt | |
| run-id: ${{ github.event.workflow_run.id }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Read releasebranch.txt | |
| id: releasebranch | |
| run: | | |
| echo "branch=$(cat releasebranch.txt)" >> "$GITHUB_OUTPUT" | |
| rm releasebranch.txt | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ (github.event_name == 'workflow_run' && steps.releasebranch.outputs.branch) || github.ref }} | |
| fetch-depth: 0 | |
| - name: Install node 24 | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Install project modules | |
| run: npm ci | |
| - name: Compile project | |
| run: npm run compile | |
| - name: Publish package | |
| run: npm publish --verbose --access public --provenance |