Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e20cf12
Add docker-build-and-push
nuc Jul 16, 2025
5d98b22
Put back the old one for now
nuc Jul 16, 2025
a531a15
Pass build_args to the build
nuc Jul 16, 2025
d0e86a3
Pass build_args as secret
nuc Jul 16, 2025
9125540
Define secrets in the workflow
nuc Jul 16, 2025
554bf6d
docker-build-push and create-release-pr
marek-saji Jul 22, 2025
36dfd6a
Make actionlint happy
marek-saji Jul 22, 2025
6ec1e2d
Don’t use deprecated :: commands
marek-saji Jul 22, 2025
ae07de7
Build without any tags
marek-saji Jul 22, 2025
97e4dd2
Language
marek-saji Jul 22, 2025
a700b2c
fixup! docker-build-push and create-release-pr
marek-saji Jul 22, 2025
541faab
docker-build-push: Define version_change output
marek-saji Jul 22, 2025
4ebfda3
fixup! docker-build-push and create-release-pr
marek-saji Jul 22, 2025
cd3e673
Typo
marek-saji Jul 22, 2025
5924c1a
prettier -w .
marek-saji Jul 22, 2025
917334c
Use ref-comment-in-commit action
marek-saji Jul 22, 2025
02ea9a4
Ignore VSCode config
marek-saji Jul 22, 2025
c3f287e
Revert "Don’t use deprecated :: commands"
marek-saji Jul 22, 2025
c74375a
Validate required inputs
marek-saji Jul 22, 2025
7517d37
create-release-pr: Pretty white space in CHANGELOG
marek-saji Jul 28, 2025
54ab96c
Merge remote-tracking branch 'origin/v1' into new-actions-for-buildin…
marek-saji Oct 1, 2025
b0f2c0e
Merge remote-tracking branch 'origin/v1' into HEAD
marek-saji Oct 6, 2025
fae8fa2
feat: Start adjusting workflows to new vision
marek-saji Oct 1, 2025
4475f0f
Update used actions
marek-saji Oct 1, 2025
ca3c806
feat(ci): Run npm audit signatures
marek-saji Oct 1, 2025
38e0ca4
feat(ci): Output package-manager
marek-saji Oct 2, 2025
cc15470
feat(create-release): Use semantic-release
marek-saji Oct 2, 2025
dcc6de6
feat(docker-build-push): Push to all registries in one go
marek-saji Oct 2, 2025
2ce840e
fixup! feat: Start adjusting workflows to new vision
marek-saji Oct 6, 2025
4962cdb
DEBUG: Use current branch for setup step
marek-saji Oct 6, 2025
307834e
fixup! feat(ci): Run npm audit signatures
marek-saji Oct 6, 2025
ca91c53
fixup! feat(create-release): Use semantic-release
marek-saji Oct 6, 2025
c53fc6b
fixup! feat(create-release): Use semantic-release
marek-saji Oct 6, 2025
d3f1208
chore: Kebab case for inputs
marek-saji Oct 6, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ jobs:

- name: Check if we need to install browsers
id: browsers
uses: actions/github-script@v7
uses: actions/github-script@v8
with:
script: |
const { existsSync } = require('fs');
Expand Down
161 changes: 161 additions & 0 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Create Release
#
# Template to use with this workflow:
# https://github.com/verkstedt/.github/tree/main/workflow-templates/create-release.yaml
#
# Pushes a commit that updates version data directly to the main branch.
#
# Requires GitHub token with persmissions to do that.

name: Create Release

on:
workflow_call:
inputs:
release-type:
description: 'Type of release (major, minor, patch, or prerelease)'
type: string
default: 'patch'
working-directory:
description: 'Working directory (where package.json is located)'
type: string
default: '.'

jobs:
release:
name: 'Create Release'
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write
issues: write

steps:
- name: Verify inputs
run: |
if ! echo "${{ inputs.release-type }}" | grep -qE '^(major|minor|patch|prerelease)$'
then
echo "Invalid release-type: ${{ inputs.release-type }}. Must be one of: major, minor, patch, prerelease."
exit 64 # EX_USAGE
fi

if [ "${{ inputs.release-type }}" = "prerelease" ]
then
echo "ERROR: Prerelease not supported yet." # TODO Support prerelease
exit 64 # EX_USAGE
fi

- name: Set environment variables
env:
ENV_VARS: ${{ secrets.env_vars }}
run: |
echo "$ENV_VARS" >> "$GITHUB_ENV"

- name: Setup
id: setup
uses: verkstedt/actions/setup@new-actions-for-building-pushing-and-releasing
with:
working-directory: ${{ inputs.working-directory }}
github-npm-registry-personal-access-token: ${{ secrets.GH_NPM_REGISTRY_PERSONAL_ACCESS_TOKEN }}

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Note: This script doesn’t access steps.*.outputs and
# inputs.* directly to make it easier to copy it to separate
# file for testing
PACKAGE_MANAGER: ${{ steps.setup.outputs.package-manager }}
RELEASE_TYPE: ${{ inputs.release-type }}
run: |
echo "::group::Prepare semantic-release configuration"
# TODO Move this to separate package, that can be installed, together with dependencies
release_config_mjs="$( mktemp --suffix=.mjs )"
cat > "$release_config_mjs" << 'RELEASE_CONFIG_MJS_EOF'
/**
* @type {import('semantic-release').GlobalConfig}
*/
export default {
plugins: [
["@semantic-release/exec", {
// Do not analyse commits to determine release type
analyzeCommitsCmd: `echo ${process.env.RELEASE_TYPE}`,
// Update version.txt, if exists
prepareCmd: 'if [ -f version.txt ]; then echo "${nextRelease.version}" > version.txt; fi',
// Use GitHub API to generate release notes
generateNotesCmd: `
gh api \
-X POST \
repos/:owner/:repo/releases/generate-notes \
-f tag_name='\${nextRelease.gitTag}' \
-f previous_tag_name='\${lastRelease.gitTag}' \
--jq '"# " + .name + "\n\n" + .body'
`,
// Write release notes to GitHub Actions summary
successCmd: `echo '\${nextRelease.notes}' >> \$GITHUB_STEP_SUMMARY`,
}],
// Update version package.json, do not publish to npm registry
['@semantic-release/npm', {
npmPublish: false
}],
// Write changelog
['@semantic-release/changelog'],
// Commit and push changed files
['@semantic-release/git', {
assets: ['CHANGELOG.md', 'package.json', 'package-lock.json', 'version.txt'],
message: 'chore(release): ${nextRelease.version}\n\n\${nextRelease.notes}'
}],
// Register a GitHub release
['@semantic-release/github'],
]
}
RELEASE_CONFIG_MJS_EOF
echo "::endgroup::"

# Clean up
trap 'rm -fv "$release_config_mjs"' EXIT INT TERM

# FIXME This feels wrong, but couldn’t find a way of running semantic-release without having plugins installed
echo "::group::Install semantic-release plugins"
npm_pkg_args=$(
node --input-type=module --eval "
const { default: config } = await import(process.argv[1], { assert: { type: 'module' } });
process.stdout.write(
config.plugins
.map(p => Array.isArray(p) ? p[0] : p)
.filter(p => ! /^(\\.\\/|\\.\\.\\/|\/)/.test(p))
.join('\\n')
);
" "$release_config_mjs" |
# Skip plugins bundled with semantic-release
# https://semantic-release.gitbook.io/semantic-release/usage/plugins#default-plugins
# Docs also list @semantic-release/npm, but it doesn’t seem true
grep -vE '@semantic-release/commit-analyzer|@semantic-release/release-notes-generator|@semantic-release/github'
)

if [ -n "$npm_pkg_args" ]
then
case "$PACKAGE_MANAGER" in
yarn)
# shellcheck disable=SC2086
yarn add -D $npm_pkg_args
;;
npm)
# shellcheck disable=SC2086
npm install -D $npm_pkg_args
;;
*)
echo "Unsupported package manager: $PACKAGE_MANAGER"
exit 69 # EX_UNAVAILABLE
;;
esac

git restore package.json || :
git restore package-lock.json || :
git restore yarn.lock || :
fi
echo "::endgroup::"

echo "::group::Run semantic-release"
npx --yes semantic-release --extends "$release_config_mjs" "$@"
echo "::endgroup::"
Loading