Build And Publish Latest Release #33
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: Build And Publish Latest Release | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-npm-packages: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| uses: ./.github/workflows/build-npm-packages.yaml | |
| build-mika-shell: | |
| needs: build-npm-packages | |
| permissions: | |
| contents: write | |
| id-token: write | |
| uses: ./.github/workflows/build-mika-shell.yaml | |
| release: | |
| needs: build-mika-shell | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download Debug Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mika-shell-debug | |
| - name: Download Release Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mika-shell | |
| - name: Download Core Package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: npm-package-core | |
| - name: Download Extra Package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: npm-package-extra | |
| - name: Delete Old Releases | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| tags=$(gh release list --json tagName --jq '.[].tagName' | grep latest || true) | |
| echo "$tags" | xargs --no-run-if-empty -I {} gh release delete {} --yes | |
| echo "$tags" | xargs --no-run-if-empty -I {} gh api --method DELETE /repos/${{ github.repository }}/git/refs/tags/{} | |
| sleep 5 | |
| - name: Get Latest Commit Hash | |
| id: commit | |
| run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag_name: latest | |
| name: "Latest Release (${{ env.sha_short }})" | |
| body: "自动发布于 commit: ${{ env.sha_short }}" | |
| draft: false | |
| prerelease: false | |
| files: | | |
| mika-shell | |
| mika-shell-debug | |
| mika-shell-core-*.tgz | |
| mika-shell-extra-*.tgz |