MediaWarp v0.2.3 #31
Workflow file for this run
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: MediaWarp Releaser | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| permissions: | |
| contents: write | |
| packages: write | |
| actions: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| - name: Cancel same-commit dev workflow runs | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const sha = context.sha; | |
| const runs = await github.paginate(github.rest.actions.listWorkflowRuns, { | |
| owner, | |
| repo, | |
| workflow_id: 'dev.yaml', | |
| event: 'push', | |
| per_page: 100, | |
| }); | |
| const targets = runs.filter((run) => | |
| run.head_sha === sha && | |
| ['queued', 'in_progress', 'waiting', 'pending', 'requested'].includes(run.status) | |
| ); | |
| if (targets.length === 0) { | |
| core.info(`No running dev workflow found for commit ${sha}.`); | |
| return; | |
| } | |
| for (const run of targets) { | |
| core.info(`Cancelling dev run #${run.run_number} (id=${run.id}, status=${run.status})`); | |
| await github.rest.actions.cancelWorkflowRun({ | |
| owner, | |
| repo, | |
| run_id: run.id, | |
| }); | |
| } | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: "go.mod" # 使用 go.mod 文件中的 golang 版本 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| distribution: goreleaser | |
| version: "~> v2" | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |