Skip to content
Merged
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
103 changes: 94 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,103 @@ on:
description: "GitHub Token. Used to authenticate with GitHub at build step. This will overwrite the use of the default GitHub token."
outputs:
version:
description: "The version of the release. Will be null if no release was made."
value: ${{ jobs.release.outputs.version }}
description: "The version of the release. Will be empty if no release was made."
value: ${{ jobs.semantic-release.outputs.version }}

jobs:
release:
semantic-release:
name: Semantic release
runs-on: ubuntu-latest
environment: ${{ inputs.ENVIRONMENT || '' }}
permissions:
contents: write
packages: write
id-token: write
name: Release
if: github.repository == ( inputs.repository || 'ctfpilot/ci')
uses: the0mikkel/ci/.github/workflows/semver-release-standalone.yml@v1.4.1
secrets: inherit
with:
ENVIRONMENT: ${{ inputs.ENVIRONMENT }}
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "lts/*"
- name: Install dependencies
run: npm install semantic-release @semantic-release/exec @semantic-release/commit-analyzer @semantic-release/git @semantic-release/github @semantic-release/release-notes-generator conventional-changelog-conventionalcommits -D
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Detect if configuration file is available for semantic-release
id: check-config
run: |
if [ -f .releaserc.json ] || [ -f .releaserc ] || [ -f release.config.js ]; then
echo "config_exists=true" >> $GITHUB_OUTPUT
else
echo "config_exists=false" >> $GITHUB_OUTPUT
fi
- name: Set default configuration file for semantic-release
if: steps.check-config.outputs.config_exists == 'false'
run: |
cat << 'EOF' > .releaserc.json
{
"branches": [
"main",
{
"name": "develop",
"prerelease": "r"
}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/github",
{
"successComment": false
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "echo ${nextRelease.version} > version.txt",
"publishCmd": "echo 'Published version ${nextRelease.version}'"
}
],
[
"@semantic-release/git",
{
"assets": [],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
EOF
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GH_TOKEN || secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.RELEASE_GH_TOKEN || secrets.GITHUB_TOKEN }}
run: |
npx semantic-release 2>&1 | tee semantic-release.log
status=${PIPESTATUS[0]}
exit $status
- name: Archive release log
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The semantic-release log artifact upload should be conditional to handle cases where the Release step fails before creating the log file. Add if: always() to ensure the artifact upload runs even if previous steps fail:

- name: Archive release log
  if: always()
  uses: actions/upload-artifact@v5
Suggested change
- name: Archive release log
- name: Archive release log
if: always()

Copilot uses AI. Check for mistakes.
uses: actions/upload-artifact@v5
with:
name: semantic-release.log
path: semantic-release.log
- name: Get version
id: version
run: echo version=$(grep -oP "next release version is \K.*" semantic-release.log || echo "") >> $GITHUB_OUTPUT
Loading