mirror of
https://github.com/lukaszraczylo/shared-actions.git
synced 2026-06-26 05:16:46 +00:00
Compare commits
5 Commits
486ef6e3a1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 72ef4441eb | |||
| a4cf065ea1 | |||
| 58ab34e4cf | |||
| fb34ae51e5 | |||
| cc643787c5 |
@@ -33,6 +33,18 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
# Fold any build-time source changes (e.g. version stamping by a
|
||||||
|
# repo-local workflow-prepare.sh) into the tagged commit. This is needed
|
||||||
|
# so consumers that fetch the tag's SOURCE — e.g. Yaegi-interpreted
|
||||||
|
# Traefik plugins, which Traefik never compiles — see the stamped value,
|
||||||
|
# and so GoReleaser's `release --clean` sees a clean working tree. The
|
||||||
|
# commit is reachable only via the tag; the branch is NOT advanced, so a
|
||||||
|
# source-tree placeholder (e.g. 0.0.0-dev on main) is preserved. No-op
|
||||||
|
# when the tree is already clean → unchanged for repos that don't stamp.
|
||||||
|
if ! git diff --quiet || ! git diff --cached --quiet; then
|
||||||
|
git add -A
|
||||||
|
git commit -m "chore(release): ${{ inputs.version-tag }}"
|
||||||
|
fi
|
||||||
git tag -a ${{ inputs.version-tag }} -m "Release ${{ inputs.version-tag }}" || true
|
git tag -a ${{ inputs.version-tag }} -m "Release ${{ inputs.version-tag }}" || true
|
||||||
if [[ "${{ inputs.mode }}" != "split" ]]; then
|
if [[ "${{ inputs.mode }}" != "split" ]]; then
|
||||||
git push origin ${{ inputs.version-tag }} || true
|
git push origin ${{ inputs.version-tag }} || true
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
|
runner:
|
||||||
|
description: "Runner label(s) for the release jobs. Defaults to ubuntu-latest; set to a self-hosted label (e.g. self-hosted) to run on your own runner."
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "ubuntu-latest"
|
||||||
outputs:
|
outputs:
|
||||||
version:
|
version:
|
||||||
description: "The calculated version (without v prefix)"
|
description: "The calculated version (without v prefix)"
|
||||||
@@ -44,7 +49,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ inputs.runner }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -67,7 +72,7 @@ jobs:
|
|||||||
version:
|
version:
|
||||||
name: Calculate Version
|
name: Calculate Version
|
||||||
needs: test
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ inputs.runner }}
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.semver.outputs.version }}
|
version: ${{ steps.semver.outputs.version }}
|
||||||
version_tag: ${{ steps.semver.outputs.version_tag }}
|
version_tag: ${{ steps.semver.outputs.version_tag }}
|
||||||
@@ -96,7 +101,7 @@ jobs:
|
|||||||
name: Release
|
name: Release
|
||||||
needs: version
|
needs: version
|
||||||
if: needs.version.outputs.version_tag != ''
|
if: needs.version.outputs.version_tag != ''
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ inputs.runner }}
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
packages: write
|
packages: write
|
||||||
@@ -109,6 +114,14 @@ jobs:
|
|||||||
lfs: ${{ inputs.lfs }}
|
lfs: ${{ inputs.lfs }}
|
||||||
|
|
||||||
- name: Run workflow prepare script
|
- name: Run workflow prepare script
|
||||||
|
# Expose the computed release version to a repo-local workflow-prepare.sh
|
||||||
|
# (e.g. to stamp the version into source for runtimes that cannot resolve
|
||||||
|
# it at build time, such as Yaegi-interpreted Traefik plugins). Only the
|
||||||
|
# release job has a version; the test/version jobs run the hook without
|
||||||
|
# it. VERSION is the bare semver (1.2.3); VERSION_TAG keeps the v prefix.
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.version.outputs.version }}
|
||||||
|
VERSION_TAG: ${{ needs.version.outputs.version_tag }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [ -f "./workflow-prepare.sh" ]; then
|
if [ -f "./workflow-prepare.sh" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user