Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create workflow for dev releases from develop branch #89

Merged
merged 49 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1c710c1
ci: dev releases workflow
TheLastCicada Nov 26, 2024
29018b0
ci: test dev release workflow
TheLastCicada Dec 4, 2024
7c9df53
ci: update tag matching if statement
TheLastCicada Dec 4, 2024
32cfadf
ci: set github token environment
TheLastCicada Dec 4, 2024
c670928
ci: push the tag delete before creating new tag
TheLastCicada Dec 4, 2024
934e0b9
ci: delete tag at origin
TheLastCicada Dec 4, 2024
b370cc2
ci: clear labels
TheLastCicada Dec 4, 2024
fbedd37
ci: only sign on releases
TheLastCicada Dec 4, 2024
c43fc0b
ci: concurrency adjustments to only run latest version of this
TheLastCicada Dec 4, 2024
fe599bf
ci: remove innaccurate comment
TheLastCicada Dec 4, 2024
c007f6a
ci: understand gh cli release visibility
TheLastCicada Dec 4, 2024
641074b
ci: release logic for managing release
TheLastCicada Dec 4, 2024
68b11b8
ci: reverse dev release logic
TheLastCicada Dec 4, 2024
2c4ba85
ci: stop making dev releases marked as latest
TheLastCicada Dec 4, 2024
2674300
ci: latest comment
TheLastCicada Dec 4, 2024
e929529
ci: just don't error out when deleting the dev release
TheLastCicada Dec 4, 2024
1a04a71
ci: more release name matching
TheLastCicada Dec 4, 2024
606840b
ci: upgrade release action
TheLastCicada Dec 4, 2024
caaf08f
ci: print out the release list at the end of the job
TheLastCicada Dec 4, 2024
04bf1df
ci: target develop branch for dev workflows
TheLastCicada Dec 4, 2024
0d2b0bf
ci: flags for latest and prerelease for the release
TheLastCicada Dec 4, 2024
3940f40
ci: run on branch also
TheLastCicada Dec 4, 2024
a72d1ae
ci: formatting and cleanup
TheLastCicada Dec 4, 2024
0417b40
ci: set the branch target final
TheLastCicada Dec 5, 2024
8913023
ci: test rc version logic
TheLastCicada Dec 5, 2024
a303198
ci: formatting
TheLastCicada Dec 5, 2024
a10017a
ci: jq expression
TheLastCicada Dec 5, 2024
4240680
ci: use rc prerelease naming
TheLastCicada Dec 5, 2024
1ee05b7
ci: improve bash if statement
TheLastCicada Dec 5, 2024
7a64cee
ci: build installers with correct version
TheLastCicada Dec 5, 2024
c563549
ci: increment patch number
TheLastCicada Dec 5, 2024
e67fc7d
ci: make windows shell run as bash
TheLastCicada Dec 5, 2024
3fe2518
ci: handle a failed release and orphaned tag
TheLastCicada Dec 5, 2024
9902eee
ci: fix rc version overwrite for package.json
TheLastCicada Dec 6, 2024
544e3af
ci: use correct github variable naming in script
TheLastCicada Dec 6, 2024
88b2c51
ci: more work to get jq right
TheLastCicada Dec 6, 2024
5a459d1
ci: fix typo
TheLastCicada Dec 6, 2024
b446251
ci: if statement brackets
TheLastCicada Dec 6, 2024
0bfe18b
ci: update to node 20.16
TheLastCicada Dec 6, 2024
60ec3c3
ci: better bash pattern matching
TheLastCicada Dec 6, 2024
07e77d0
ci: rename jobs and files
TheLastCicada Dec 6, 2024
b6086bc
ci: remove some debugging code
TheLastCicada Dec 6, 2024
e773f9d
Update .github/workflows/auto-release-rc.yml
TheLastCicada Dec 10, 2024
63b7198
ci: remove reference to dev tag
TheLastCicada Dec 10, 2024
52edb5e
Merge branch 'dev-releases' of github.com:Chia-Network/core-registry-…
TheLastCicada Dec 10, 2024
19b10dc
ci: comment update
TheLastCicada Dec 10, 2024
ffd6aac
ci: re-enable apt repo on stable release
TheLastCicada Dec 10, 2024
6f72682
ci: update token
TheLastCicada Dec 16, 2024
afc2d5d
ci: target develop and not testing branch
TheLastCicada Dec 16, 2024
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
79 changes: 79 additions & 0 deletions .github/workflows/auto-release-rc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Compares the version in package.json to tags on the repo. If the tag doesn't exist, a new tag is created, which
# then triggers the normal "on tag" release automation in the build job
name: Auto Tag RC

on:
push:
branches:
- develop

concurrency:
group: rc-release-check

jobs:
release-dev:
name: Release rc version
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
uses: actions/checkout@v4
with:
# Need REPO_COMMIT token so when the tag is created, the tag automation runs
token: ${{ secrets.REPO_COMMIT }}
fetch-depth: 0

- name: Setup commit signing for ChiaAutomation
uses: Chia-Network/actions/commit-sign/gpg@main
with:
gpg_private_key: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_KEY }}
passphrase: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_PASSPHRASE }}

- name: Check for current version tag. Create if it doesn't exist
env:
GH_TOKEN: ${{ github.token }}
run: |
stable_version=$(gh release list --limit 1 --order desc --exclude-pre-releases --json tagName --jq ".[].tagName")
echo "Latest release is $stable_version"
rc_version=$(gh release list --json tagName --jq ".[] | select(.tagName | test(\"${version}-rc*\")) | .tagName")
echo "Latest release candidate is $rc_version"

if [[ -z ${rc_version} ]]; then
# Extract the major, minor, and patch versions
IFS='.' read -r major minor patch <<< "$stable_version"

# Increment the patch version
new_patch=$((patch + 1))

# Construct the new version string
version="$major.$minor.$new_patch-rc1"

echo "New version: $version"

else
# Extract the major, minor, patch, and rc parts
IFS='.-' read -r major minor patch rc <<< "$rc_version"

# Extract just the number of the rc
rc_number="${rc#rc}"

# Increment the rc number
rc_number=$((rc_number +1))

# Construct the new version string
version="$major.$minor.$patch-rc$rc_number"

echo "New version: $version"

fi

if [ $(git tag -l "$version") ]; then
echo "$version tag exists, deleting..."
git tag -d $version
git push --delete origin $version
fi
echo "Tag does not exist. Creating and pushing tag"
rm -f CHANGELOG.md
npx conventional-changelog-cli -p angular -i CHANGELOG.md -s -r 0
changes=$(npx conventional-changelog-cli -r 1 | tail -n +2)
git tag $version -m "Release $version $changes"
git push origin $version
8 changes: 4 additions & 4 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ concurrency:
group: main-release-check

jobs:
check-version:
name: Check version increment
check-version-and-release:
name: Check version increment and release
runs-on: ubuntu-latest
steps:
- name: Clean workspace
Expand All @@ -21,8 +21,8 @@ jobs:
- name: Checkout current branch
uses: actions/checkout@v4
with:
# Need PACKAGE_ADMIN_PAT token so when the tag is created, the tag automation runs
token: ${{ secrets.PACKAGE_ADMIN_PAT }}
# Need REPO_COMMIT token so when the tag is created, the tag automation runs
token: ${{ secrets.REPO_COMMIT }}
fetch-depth: 0

- name: Setup commit signing for ChiaAutomation
Expand Down
90 changes: 73 additions & 17 deletions .github/workflows/build-installers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ on:
push:
tags:
- '**'
branches:
- refactor/refactor-base #remove this once rebuild is merged
pull_request:
branches:
- '**'

concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

permissions:
Expand All @@ -35,14 +32,24 @@ jobs:
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: '20.10'
node-version: '20.16'

- name: Install Husky
run: npm install --save-dev husky

- name: install dmg-license
run: npm i dmg-license

- name: Change the package.json version if an RC tag
if: startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
run: |
echo "Github ref: $GITHUB_REF"
IFS='/' read -r base directory tag <<< "$GITHUB_REF"
echo "Extracted tag is $tag"

jq ".version = \"${tag}\"" package.json > package.tmp
mv package.tmp package.json

- name: npm install
run: |
npm install
Expand All @@ -59,7 +66,7 @@ jobs:
SIGNING_SECRET: "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}"

- name: Import Apple installer signing certificate
if: steps.check_secrets.outputs.HAS_SIGNING_SECRET
if: steps.check_secrets.outputs.HAS_SIGNING_SECRET && startsWith(github.ref, 'refs/tags/')
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_DEV_ID_APP }}
Expand All @@ -71,7 +78,7 @@ jobs:
run: npm run electron:package:mac

- name: Notarize
if: steps.check_secrets.outputs.HAS_SIGNING_SECRET
if: steps.check_secrets.outputs.HAS_SIGNING_SECRET && startsWith(github.ref, 'refs/tags/')
run: |
DMG_FILE=$(find ${{ github.workspace }}/dist/ -type f -name '*.dmg')
xcrun notarytool submit \
Expand All @@ -94,17 +101,26 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Node 20.10
- name: Setup Node 20.16
uses: actions/setup-node@v4
with:
node-version: '20.10'
node-version: '20.16'

- name: Install Husky
run: npm install --save-dev husky

- name: Ignore Husky where not compatible
run: npm pkg delete scripts.prepare

- name: Change the package.json version if an RC tag
if: startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
shell: bash
run: |
IFS='/' read -r base directory tag <<< "$GITHUB_REF"

jq ".version = \"${tag}\"" package.json > package.tmp
mv package.tmp package.json

- name: npm install
run: |
node --version
Expand Down Expand Up @@ -155,14 +171,22 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Node 20.10
- name: Setup Node 20.16
uses: actions/setup-node@v4
with:
node-version: '20.10'
node-version: '20.16'

- name: Install Husky
run: npm install --save-dev husky

- name: Change the package.json version if an RC tag
if: startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
run: |
IFS='/' read -r base directory tag <<< "$GITHUB_REF"

jq ".version = \"${tag}\"" package.json > package.tmp
mv package.tmp package.json

- name: npm install
run: |
node --version
Expand Down Expand Up @@ -190,14 +214,22 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Node 20.10
- name: Setup Node 20.16
uses: actions/setup-node@v4
with:
node-version: '20.10'
node-version: '20.16'

- name: Install Husky
run: npm install --save-dev husky

- name: Change the package.json version if an RC tag
if: startsWith(github.ref, 'refs/tags/') && contains( github.ref, '-rc')
run: |
IFS='/' read -r base directory tag <<< "$GITHUB_REF"

jq ".version = \"${tag}\"" package.json > package.tmp
mv package.tmp package.json

- name: npm install and build
run: |
node --version
Expand Down Expand Up @@ -258,29 +290,53 @@ jobs:
echo "EXE_FILE=$EXE_FILE" >>$GITHUB_ENV
echo "WEB_FILE=$WEB_FILE" >>$GITHUB_ENV

# RC release should not be set as latest
- name: Decide if release should be set as latest
id: is_latest
shell: bash
run: |
unset IS_LATEST

echo "Github ref is $GITHUB_REF"

if [[ "$GITHUB_REF" =~ "-rc" ]]; then
echo "release candidate tag matched"
IS_LATEST='false'
IS_PRERELEASE='true'
else
echo "main branch release matched"
IS_LATEST='true'
IS_PRERELEASE='false'
fi

echo "IS_LATEST=${IS_LATEST}" >> "$GITHUB_OUTPUT"
echo "IS_PRERELEASE=${IS_PRERELEASE}" >> "$GITHUB_OUTPUT"

- name: Release
uses: softprops/action-gh-release@v0.1.15
uses: softprops/action-gh-release@v2.1.0
with:
prerelease: ${{steps.is_latest.outputs.IS_PRERELEASE}}
make_latest: "${{steps.is_latest.outputs.IS_LATEST}}"
files: |
${{ env.DMG_FILE }}
${{ env.DEB_FILE }}
${{ env.EXE_FILE }}
${{ env.WEB_FILE }}

- name: Get repo name
if: startsWith(github.ref, 'refs/tags/') && !contains( github.ref, '-rc')
TheLastCicada marked this conversation as resolved.
Show resolved Hide resolved
id: repo-name
run: |
echo "REPO_NAME=$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f 2)" >>$GITHUB_OUTPUT

- name: Get tag name
if: startsWith(github.ref, 'refs/tags/') && !contains( github.ref, '-rc')
id: tag-name
run: |
echo "TAGNAME=$(echo $GITHUB_REF | cut -d / -f 3)" >>$GITHUB_OUTPUT

- name: Gets JWT Token from GitHub
uses: Chia-Network/actions/github/jwt@main

- name: Trigger apt repo update
if: startsWith(github.ref, 'refs/tags/') && !contains( github.ref, '-rc')
uses: Chia-Network/actions/github/glue@main
with:
json_data: '{"climate_tokenization_repo":"${{ steps.repo-name.outputs.REPO_NAME }}","application_name":"[\"${{ env.APP_NAME }}\"]","release_version":"${{ steps.tag-name.outputs.TAGNAME }}","add_debian_version":"true","arm64":"available"}'
Expand Down
Loading