mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 13:21:00 +00:00
Each run of releaser-pleaser acts on the same global state in the forge. Therefore, parallel runs are unnecessary. This commit also communicates to the GitHub and GitLab CI pipelines that the releaser-pleaser jobs can be cancelled as early as possible. - On GitHub Actions this can be guaranteed through the workflow settings. These settings are copied into each repository that uses releaser-pleaser, so users need to update this manually. I will add a note to the release notes for this. - On GitLab CI/CD this requires the user to configure a project level setting to "auto-cancel redundant pipelines". We will not recommend user to set this, as it is quite invasive and can break their regular CI pipelines.
53 lines
1.9 KiB
YAML
53 lines
1.9 KiB
YAML
name: releaser-pleaser
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
# Using pull_request_target to avoid tainting the actual release PR with code from open feature pull requests
|
|
pull_request_target:
|
|
types:
|
|
- edited
|
|
- labeled
|
|
- unlabeled
|
|
|
|
# Only one job needs to run at a time, if a new job is started there is probably new data to include in the response, so
|
|
# it does not make sense to finish the previous job. This also helps with "data-race conflicts", where a human changes
|
|
# the PR description but releaser-pleaser was already running and overwrites the humans changes.
|
|
concurrency:
|
|
group: releaser-pleaser
|
|
cancel-in-progress: true
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
releaser-pleaser:
|
|
# TODO: if: push or pull_request.closed
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
ref: main
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
# Build container image from current commit and replace image ref in `action.yml`
|
|
# Without this, any new flags in `action.yml` would break the job in this repository until the new
|
|
# version is released. But a new version can only be released if this job works.
|
|
- uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
|
|
- run: ko build --bare --local --tags ci github.com/apricote/releaser-pleaser/cmd/rp
|
|
|
|
- run: mkdir -p .github/actions/releaser-pleaser
|
|
- run: "sed -i 's|image: .*$|image: docker://ghcr.io/apricote/releaser-pleaser:ci|g' action.yml"
|
|
|
|
# Dogfood the action to make sure it works for users.
|
|
- name: releaser-pleaser
|
|
uses: ./
|
|
with:
|
|
token: ${{ secrets.RELEASER_PLEASER_TOKEN }}
|
|
extra-files: |
|
|
action.yml
|
|
templates/run.yml
|