Help with workflow, build app with next version before release #3357
-
Hello. I've used semantic-release for a while, but I'm unable to find a solution for my "problem" and I hope someone could help me.
But, I'm unable to implement this, because, if I build the app first, it'll be using the old version in the app, if I build after the semantic-release, the image won't go in the release assets. A nice to have would be the docker image name/tag match the git tag as well. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Well, I ask and manage to answer to myself :D
name: Bump version, build and release
on:
push:
branches:
- main
- dev
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
token: "${{ secrets.PAT }}"
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Get next version
run: pnpm semantic-release:next-version
env:
GH_TOKEN: ${{ secrets.PAT}}
- name: Build
env:
APP_VERSION: ${{ env.NEXT_RELEASE_VERSION }}
run: pnpm build
- name: Zip dist folder
run: zip -r dist.zip dist
- name: Release
run: pnpm semantic-release
env:
GH_TOKEN: ${{ secrets.PAT}} The script
/**
* @type {import('semantic-release').GlobalConfig}
*/
export default {
branches: [
"main",
"next",
{
name: "dev",
prerelease: true,
},
],
plugins: [
[
"@semantic-release/commit-analyzer",
{
parserOpts: {
noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"],
},
preset: "angular",
releaseRules: [
{
release: false,
scope: "wip",
},
{
release: false,
scope: "WIP",
},
{
release: false,
scope: "no-release",
},
],
},
],
[
"@semantic-release/exec",
{
verifyReleaseCmd:
'echo "NEXT_RELEASE_VERSION=${nextRelease.version}" >> $GITHUB_ENV',
},
],
[
"@semantic-release/release-notes-generator",
{
parserOpts: {
noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"],
},
preset: "angular",
writerOpts: {
commitsSort: ["subject", "scope"],
},
},
],
[
"@semantic-release/changelog",
{
changelogFile: "docs/CHANGELOG.md",
},
],
[
"@semantic-release/npm",
{
npmPublish: false,
},
],
[
"@semantic-release/git",
{
assets: ["package.json", "pnpm-lock.yaml", "CHANGELOG.md"],
},
],
[
"@semantic-release/github",
{
assets: [
{ path: "dist.zip", label: "dist-${nextRelease.gitTag}" },
{ path: "CHANGELOG.md", label: "Changelog" },
],
},
],
],
publishConfig: {
access: "restricted",
},
}; |
Beta Was this translation helpful? Give feedback.
Well, I ask and manage to answer to myself :D
release.yml
: