Skip to content

Commit

Permalink
ci: release with actions CP-8864 (#1524)
Browse files Browse the repository at this point in the history
Co-authored-by: Michał Leszczyk <[email protected]>
  • Loading branch information
gergelylovas and meeh0w authored Jul 25, 2024
1 parent e1e0f03 commit 76486a9
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 117 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
name: Push to release branch

on:
push:
branches:
- release
name: Create prod release
on: workflow_dispatch
jobs:
release:
name: Release
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Create .npmrc
Expand Down Expand Up @@ -60,10 +56,5 @@ jobs:
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCH: release
run: yarn run semantic-release
- name: Rebase main
run: |
git checkout main &&
git rebase release &&
git push origin main
RELEASE_TYPE: production
run: yarn run semantic-release --branches ${{ github.ref_name }}
4 changes: 2 additions & 2 deletions .github/workflows/main_branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
environment: alpha
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Create .npmrc
Expand Down
42 changes: 5 additions & 37 deletions .releaserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,30 +85,6 @@ const githubSetting = [
},
];

const gitSetting = [
'@semantic-release/git',
{
assets: ['package.json'],
message:
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
},
];

/**
* This is used to publish to npm, however, we set that flag false and thus the
* plugin acts as a package.json version updater.
*/
const npmRelease = [
'@semantic-release/npm',
{
npmPublish: false,
},
];

const changelogGen = ['@semantic-release/changelog', {}];

const releaseNotesGen = ['@semantic-release/release-notes-generator', {}];

const execZipSetting = [
'@semantic-release/exec',
{
Expand All @@ -131,10 +107,6 @@ if (process.env && process.env.RELEASE_BRANCH === 'release') {
releaseReplaceSetting,
execZipSetting,
githubSetting,
changelogGen,
releaseNotesGen,
npmRelease,
gitSetting,
];
} else {
plugins = [
Expand All @@ -143,19 +115,15 @@ if (process.env && process.env.RELEASE_BRANCH === 'release') {
releaseReplaceSetting,
execZipSetting,
githubSetting,
gitSetting,
];
}

module.exports = {
// define a main version release branch even though we are doing all releases from main
// this branch list gets overwritten in the production release Github Action
branches: [
{
name: 'release',
},
{
name: 'main',
prerelease: 'alpha',
},
],
'release',
{ name: 'main', prerelease: 'alpha'}
],
plugins,
};
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ Bundles can be found in the "Releases" section of the repo.

### Production releases

Production releases are created after each merge into the `release` branch.
To create a Production release:
Production releases are created by the `Create prod release` Github action.
The action needs to be triggered manually, and can be triggered on any branch making it easier to create hotfix releases.

- Open a PR from `main` to `release`
- Wait for CI to complete
- Make sure branch protection rules allow the CI to push the tags to `main` and `release` branches
- Merge the PR by creating a merge commit
- Make sure the branch you are creating the release on is clean and good to go
- Go to Actions and select the "Create prod release" action
- Click "Run workflow" and select the target branch
- After the workflow run is complete, the new release is automatically pushed to the Releses age of the repo and the commit gets tagged
- After green light from QA, upload the build to the Chrome

### Create a production release locally
Expand Down
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "avalanche-extension",
"version": "1.82.0",
"version": "0.0.0",
"license": "Limited Ecosystem License",
"scripts": {
"start": "yarn dev",
Expand Down Expand Up @@ -113,13 +113,9 @@
"@google/semantic-release-replace-plugin": "1.1.0",
"@lavamoat/allow-scripts": "2.0.0",
"@lavamoat/preinstall-always-fail": "1.0.0",
"@semantic-release/changelog": "6.0.1",
"@semantic-release/commit-analyzer": "9.0.2",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "8.0.2",
"@semantic-release/npm": "9.0.1",
"@semantic-release/release-notes-generator": "10.0.3",
"@testing-library/react": "12.1.5",
"@testing-library/react-hooks": "8.0.1",
"@types/argon2-browser": "1.18.4",
Expand Down
54 changes: 2 additions & 52 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4982,16 +4982,6 @@
"@noble/hashes" "~1.3.2"
"@scure/base" "~1.1.4"

"@semantic-release/[email protected]":
version "6.0.1"
resolved "https://registry.yarnpkg.com/@semantic-release/changelog/-/changelog-6.0.1.tgz#8dd0334fd8c7d50cda747d2591e4f18f816b3c9c"
integrity sha512-FT+tAGdWHr0RCM3EpWegWnvXJ05LQtBkQUaQRIExONoXjVjLuOILNm4DEKNaV+GAQyJjbLRVs57ti//GypH6PA==
dependencies:
"@semantic-release/error" "^3.0.0"
aggregate-error "^3.0.0"
fs-extra "^9.0.0"
lodash "^4.17.4"

"@semantic-release/[email protected]", "@semantic-release/commit-analyzer@^9.0.2":
version "9.0.2"
resolved "https://registry.yarnpkg.com/@semantic-release/commit-analyzer/-/commit-analyzer-9.0.2.tgz#a78e54f9834193b55f1073fa6258eecc9a545e03"
Expand Down Expand Up @@ -5027,20 +5017,6 @@
lodash "^4.17.4"
parse-json "^5.0.0"

"@semantic-release/[email protected]":
version "10.0.1"
resolved "https://registry.yarnpkg.com/@semantic-release/git/-/git-10.0.1.tgz#c646e55d67fae623875bf3a06a634dd434904498"
integrity sha512-eWrx5KguUcU2wUPaO6sfvZI0wPafUKAMNC18aXY4EnNcrZL86dEmpNVnC9uMpGZkmZJ9EfCVJBQx4pV4EMGT1w==
dependencies:
"@semantic-release/error" "^3.0.0"
aggregate-error "^3.0.0"
debug "^4.0.0"
dir-glob "^3.0.0"
execa "^5.0.0"
lodash "^4.17.4"
micromatch "^4.0.0"
p-reduce "^2.0.0"

"@semantic-release/[email protected]":
version "8.0.2"
resolved "https://registry.yarnpkg.com/@semantic-release/github/-/github-8.0.2.tgz#80114a41f6ec8ab6c0d38a436b48ff3f2223ab16"
Expand Down Expand Up @@ -5085,25 +5061,6 @@
p-retry "^4.0.0"
url-join "^4.0.0"

"@semantic-release/[email protected]":
version "9.0.1"
resolved "https://registry.yarnpkg.com/@semantic-release/npm/-/npm-9.0.1.tgz#d81828eb1fb771e2767b3a8ee989915e1af27075"
integrity sha512-I5nVZklxBzfMFwemhRNbSrkiN/dsH3c7K9+KSk6jUnq0rdLFUuJt7EBsysq4Ir3moajQgFkfEryEHPqiKJj20g==
dependencies:
"@semantic-release/error" "^3.0.0"
aggregate-error "^3.0.0"
execa "^5.0.0"
fs-extra "^10.0.0"
lodash "^4.17.15"
nerf-dart "^1.0.0"
normalize-url "^6.0.0"
npm "^8.3.0"
rc "^1.2.8"
read-pkg "^5.0.0"
registry-auth-token "^4.0.0"
semver "^7.1.2"
tempy "^1.0.0"

"@semantic-release/npm@^9.0.0":
version "9.0.2"
resolved "https://registry.yarnpkg.com/@semantic-release/npm/-/npm-9.0.2.tgz#0f0903b4df6e93ef237372146bc376087fed4e1d"
Expand All @@ -5123,7 +5080,7 @@
semver "^7.1.2"
tempy "^1.0.0"

"@semantic-release/release-notes-generator@10.0.3", "@semantic-release/release-notes-generator@^10.0.0":
"@semantic-release/release-notes-generator@^10.0.0":
version "10.0.3"
resolved "https://registry.yarnpkg.com/@semantic-release/release-notes-generator/-/release-notes-generator-10.0.3.tgz#85f7ca78bfa6b01fb5fda0ac48112855d69171dc"
integrity sha512-k4x4VhIKneOWoBGHkx0qZogNjCldLPRiAjnIpMnlUh6PtaWXp/T+C9U7/TaNDDtgDa5HMbHl4WlREdxHio6/3w==
Expand Down Expand Up @@ -17679,7 +17636,7 @@ [email protected]:
iconv-lite "0.4.24"
unpipe "1.0.0"

rc@1.2.8, rc@^1.2.8:
rc@^1.2.8:
version "1.2.8"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==
Expand Down Expand Up @@ -18264,13 +18221,6 @@ regexpu-core@^5.3.1:
unicode-match-property-ecmascript "^2.0.0"
unicode-match-property-value-ecmascript "^2.1.0"

registry-auth-token@^4.0.0:
version "4.2.2"
resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-4.2.2.tgz#f02d49c3668884612ca031419491a13539e21fac"
integrity sha512-PC5ZysNb42zpFME6D/XlIgtNGdTl8bBOCw90xQLVMpzuuubJKYDWFAEuUNc+Cn8Z8724tg2SDhDRrkVEsqfDMg==
dependencies:
rc "1.2.8"

registry-auth-token@^5.0.0:
version "5.0.2"
resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-5.0.2.tgz#8b026cc507c8552ebbe06724136267e63302f756"
Expand Down

0 comments on commit 76486a9

Please sign in to comment.