Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/actions/stamp-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Stamp version
description: Replace the canary version in config/app.php with the release version and fail if the replacement did not happen

inputs:
version:
description: The version to stamp, with or without the leading v
required: true

runs:
using: composite
steps:
- name: Stamp version in config/app.php
shell: bash
env:
VERSION: ${{ inputs.version }}
run: |
VERSION="${VERSION#v}"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]]; then
echo "Invalid version '$VERSION', refusing to update config"
exit 1
fi
sed -i "s|'version' => 'canary',|'version' => '$VERSION',|" config/app.php
Comment thread
coderabbitai[bot] marked this conversation as resolved.
if ! grep -qF "'version' => '$VERSION'," config/app.php; then
echo "Version stamp failed, config/app.php still does not contain '$VERSION'"
exit 1
fi
11 changes: 4 additions & 7 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,10 @@ jobs:

- name: Update version in config/app.php (tag)
if: "(github.event_name == 'release' && github.event.action == 'published') || github.event_name == 'schedule'"
run: |
VERSION="${{ github.event_name == 'schedule' && steps.release_info.outputs.version_tag || steps.build_info.outputs.version_tag }}"
if [ -z "$VERSION" ] || [ "$VERSION" = "refs/heads/main" ]; then
echo "Invalid version tag, refusing to update config"
exit 1
fi
sed -i "s|'version' => 'canary',|'version' => '$VERSION',|" config/app.php
# Referenced from main instead of the working tree because scheduled runs check out a release tag that may not contain the action
uses: pelican/panel/.github/actions/stamp-version@main
Comment thread
lancepioch marked this conversation as resolved.
with:
version: ${{ github.event_name == 'schedule' && steps.release_info.outputs.version_tag || steps.build_info.outputs.version_tag }}

- name: Build and Push (tag)
uses: docker/build-push-action@v7
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ jobs:
- name: Build
run: yarn build

- name: Stamp version
uses: ./.github/actions/stamp-version
with:
version: ${{ github.ref_name }}

- name: Create release branch and bump version
env:
REF: ${{ github.ref }}
Expand All @@ -48,7 +53,6 @@ jobs:
git config --local user.name "github-actions[bot]"
git checkout -b $BRANCH
git push -u origin $BRANCH
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:11}',/" config/app.php
git add config/app.php
git commit -m "ci(release): bump version"
git push
Expand All @@ -59,9 +63,7 @@ jobs:
tar -czf panel.tar.gz * .env.example

- name: Create checksum
run: |
SUM=`sha256sum panel.tar.gz`
echo $SUM > checksum.txt
run: sha256sum panel.tar.gz > checksum.txt

- name: Create release
id: create_release
Expand Down
Loading