chore(ci): support "preview" release CI runs

Expands the trigger sources of the release CI workflow (`release.yml`),
allowing the developers to test changes to `.github/workflows/release.yml`
easily. The new trigger sources start the workflow in a "preview" mode, in
which it publishes build outputs as a CI artifact instead of creating a new
release so that they can be manually inspected.

The following events trigger the preview mode:

- Pushing to any branch matching the glob pattern `patch/ci-release-*`.
- Opening a pull request that modifies `.github/workflows/release.yml`.
- Pushing versioning tags to a forked repository.
change-detection
yvt 3 years ago committed by Michael Davis
parent 29fe0c3862
commit 0090a2d86f

@ -4,6 +4,18 @@ on:
tags: tags:
- '[0-9]+.[0-9]+' - '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+' - '[0-9]+.[0-9]+.[0-9]+'
branches:
- 'patch/ci-release-*'
pull_request:
paths:
- '.github/workflows/release.yml'
env:
# Preview mode: Publishes the build output as a CI artifact instead of creating
# a release, allowing for manual inspection of the output. This mode is
# activated if the CI run was triggered by events other than pushed tags, or
# if the repository is a fork.
preview: ${{ !startsWith(github.ref, 'refs/tags/') || github.repository != 'helix-editor/helix' }}
jobs: jobs:
fetch-grammars: fetch-grammars:
@ -268,9 +280,17 @@ jobs:
- name: Upload binaries to release - name: Upload binaries to release
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
if: env.preview == 'false'
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/* file: dist/*
file_glob: true file_glob: true
tag: ${{ steps.tagname.outputs.val }} tag: ${{ steps.tagname.outputs.val }}
overwrite: true overwrite: true
- name: Upload binaries as artifact
uses: actions/upload-artifact@v2
if: env.preview == 'true'
with:
name: release
path: dist/*

Loading…
Cancel
Save