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

Release 0.24.2 rc.51 #2201

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3b6b84c
try parallel release
bdemann Oct 14, 2024
b6aef35
WIP
bdemann Oct 14, 2024
2024b93
move into workflow
bdemann Oct 14, 2024
f78d288
fixup
bdemann Oct 14, 2024
52d6840
pass npm token secret
bdemann Oct 15, 2024
bff3610
fixup
bdemann Oct 15, 2024
a391563
fixup
bdemann Oct 15, 2024
1d4468d
install dfx before npm install
bdemann Oct 15, 2024
042cb70
make sure all commits are verified
bdemann Oct 15, 2024
1d94df3
add release version to the branch names
bdemann Oct 15, 2024
6a91528
add env variable
bdemann Oct 15, 2024
6bab4a4
update checkout
bdemann Oct 15, 2024
9b2f482
create branch
bdemann Oct 15, 2024
2da525f
remove sub release trouble shooter
bdemann Oct 15, 2024
41cffb9
make sure branches are unique
bdemann Oct 15, 2024
76f1f52
try these things
bdemann Oct 15, 2024
c539b67
update finalize release step
bdemann Oct 15, 2024
14fcc97
fetch the branch
bdemann Oct 15, 2024
d85a32d
clean up
bdemann Oct 16, 2024
58ba02b
use PAT
bdemann Oct 16, 2024
fcef3f5
correctly bring in the lastmjs pat
bdemann Oct 18, 2024
d4ebd9b
remove explicit path
bdemann Oct 18, 2024
f750d1a
Merge branch 'main' into parallel_release
lastmjs Oct 22, 2024
1b7da25
pr fixes
bdemann Oct 23, 2024
bda1f3c
further update names
bdemann Oct 23, 2024
73d0126
restore old husky install
bdemann Oct 24, 2024
10c660f
get rid of GH_TOKEN
bdemann Oct 24, 2024
e223122
Merge branch 'main' into parallel_release
bdemann Oct 24, 2024
eee67f6
install azle before updating azle
bdemann Oct 24, 2024
1314751
see if we can just fetch from the checkout
bdemann Oct 24, 2024
66bc184
WIP
bdemann Oct 24, 2024
00787bb
release--0.24.2-rc.51
bdemann Oct 24, 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
46 changes: 23 additions & 23 deletions .github/scripts/publish_github_action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,34 @@ else
npm publish
fi

# TODO loop through checking for the status instead of sleeping
echo -e "sleeping for 30 seconds to ensure azle@$VERSION is fully registered on npm"
# # TODO loop through checking for the status instead of sleeping
# echo -e "sleeping for 30 seconds to ensure azle@$VERSION is fully registered on npm"

sleep 30
# sleep 30

for directory in ${directories[@]}
do
cd "$directory"
echo "updating $directory"
# for directory in ${directories[@]}
# do
# cd "$directory"
# echo "updating $directory"

sed -E -i "s/(\"azle\": \")(.*)(\")/\1$VERSION\3/" package.json
npm install
# sed -E -i "s/(\"azle\": \")(.*)(\")/\1$VERSION\3/" package.json
# npm install

rm -rf node_modules
# rm -rf node_modules

cd $root_dir
done
# cd $root_dir
# done

git add --all
git commit -am "azle-bot automated release $VERSION"
git push origin $GITHUB_HEAD_REF
# git add --all
# git commit -am "azle-bot automated release $VERSION"
# git push origin $GITHUB_HEAD_REF

git tag $VERSION
git push origin $VERSION
# git tag $VERSION
# git push origin $VERSION

if [[ "$VERSION" == *"-rc."* ]];
then
gh release create "$VERSION" -t "$VERSION" --prerelease
else
gh release create "$VERSION" -t "$VERSION"
fi
# if [[ "$VERSION" == *"-rc."* ]];
# then
# gh release create "$VERSION" -t "$VERSION" --prerelease
# else
# gh release create "$VERSION" -t "$VERSION"
# fi
59 changes: 8 additions & 51 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:

get-test-infos:
needs: determine-should-release
# TODO can we simplify this?
# TODO make a master workflow that determines which workflow to run and when. And then all other workflows must be called and not run automatically
if: ${{ startsWith(github.head_ref, 'release--') && needs.determine-should-release.outputs.should-release }}
name: Get test infos
runs-on: ubuntu-latest
Expand All @@ -43,58 +45,13 @@ jobs:
name: Deploy release
# Only run this job if it's a release branch. This job will run instead of run-tests and will automatically publish another commit which will be tested
if: ${{ needs.determine-should-release.outputs.should-release == 'true' }}

needs:
- determine-should-release
- get-test-infos
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }}

- id: get-node-version
uses: ./.github/actions/get_node_version

- uses: actions/setup-node@v4
with:
node-version: ${{ steps.get-node-version.outputs.node-version }}
registry-url: https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install curl
run: sudo apt-get install curl -y

- id: get-dfx-version
uses: ./.github/actions/get_dfx_version

- name: Install dfx
run: |
# Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx)
src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }}
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH

- run: npm install

- name: Install global dependencies
run: |
AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic

# TODO we should use some Action-specific bot account
- name: Configure git for publishing release
run: |
git config --global user.name 'Jordan Last'
git config --global user.email '[email protected]'
git config --global commit.gpgsign true
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0

- name: Publish release
run: |
BRANCH_NAME="${{ github.head_ref }}"
RELEASE_VERSION="${BRANCH_NAME:9}"
./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(needs.get-test-infos.outputs.test-infos) }}
uses: ./.github/workflows/release_parallel.yml
secrets:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
211 changes: 211 additions & 0 deletions .github/workflows/release_parallel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
name: Parallel Release
on:
workflow_call:
secrets:
GPG_SIGNING_KEY:
required: true
NPM_TOKEN:
required: true
LASTMJS_GITHUB_TOKEN:
required: true

jobs:
prepare-release:
name: Prepare Release
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified
outputs:
release-version: ${{ steps.get-version.outputs.release-version }}
test-infos: ${{ steps.get-test-infos.outputs.test-infos }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }}

- id: get-version
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref || github.ref_name }}"
RELEASE_VERSION="${BRANCH_NAME:9}"
echo "release-version=$RELEASE_VERSION" >> $GITHUB_OUTPUT

- id: get-node-version
uses: ./.github/actions/get_node_version

- uses: actions/setup-node@v4
with:
node-version: ${{ steps.get-node-version.outputs.node-version }}
registry-url: https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install curl
run: sudo apt-get install curl -y

- id: get-dfx-version
uses: ./.github/actions/get_dfx_version

- name: Install dfx
run: |
# Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx)
src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }}
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH

- run: npm install

- name: Install global dependencies
run: |
AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic

# TODO we should use some Action-specific bot account
- name: Configure git for publishing release
run: |
git config --global user.name 'Jordan Last'
git config --global user.email '[email protected]'
git config --global commit.gpgsign true
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0

- name: Update version and build templates
run: |
VERSION=${{ steps.get-version.outputs.release-version }}
sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" package.json
sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" dfx_extension/extension.json
npm install
AZLE_VERBOSE=true npx azle template
AZLE_VERBOSE=true npx azle template --experimental

- name: Publish to npm
run: |
if [[ "${{ steps.get-version.outputs.release-version }}" == *"-rc."* ]]; then
npm publish --tag next
else
npm publish
fi

- id: get-test-infos
uses: ./.github/actions/get_test_infos
with:
directories: |
./examples
./tests

update-test-files-for-release-commit:
needs: prepare-release
name: Update ${{ matrix.test.name }}
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
strategy:
fail-fast: false
matrix:
test: ${{ fromJson(needs.prepare-release.outputs.test-infos) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }}

- id: get-node-version
uses: ./.github/actions/get_node_version

- uses: actions/setup-node@v4
with:
node-version: ${{ steps.get-node-version.outputs.node-version }}

- id: get-dfx-version
uses: ./.github/actions/get_dfx_version

- name: Install dfx
run: |
# Install dfx (Note: dfx must be installed before `npx azle` because the azle installation process requires dfx)
src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }}
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH

- name: Update azle version
run: |
npm install
cd ${{ matrix.test.path }}
sed -E -i "s/(\"azle\": \")(.*)(\")/\1${{ needs.prepare-release.outputs.release-version }}\3/" package.json
npm install
rm -rf node_modules

# TODO we should use some Action-specific bot account
- name: Commit and push changes
run: |
git config --global user.name 'Jordan Last'
git config --global user.email '[email protected]'
git config --global commit.gpgsign true
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0
BRANCH_NAME="update-${{ needs.prepare-release.outputs.release-version }}-$(echo '${{ matrix.test.displayPath }}' | sed 's/\//-/g')"
git switch -c "$BRANCH_NAME"
git add --all
if ! git diff --cached --quiet; then
git commit -m "Update dependencies for ${{ matrix.test.displayPath }}"
else
echo "No changes to commit. Skipping commit and push."
fi
git push origin "$BRANCH_NAME"

finalize-release:
needs: [prepare-release, update-test-files-for-release-commit]
name: Finalize Release
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
fetch-depth: 0

- name: Merge update branches
env:
PAT: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
run: |
git config --global user.name 'Jordan Last'
git config --global user.email '[email protected]'
git config --global commit.gpgsign true
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0

# Determine the current branch name
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "Current branch: $CURRENT_BRANCH"

# List and merge update branches
for branch in $(git branch -r | grep "origin/update-${{ needs.prepare-release.outputs.release-version }}-" | sed 's/origin\///'); do
echo "Merging branch: $branch"
git merge --no-ff "$branch" -m "Merge $branch" || {
echo "Failed to merge $branch"
git merge --abort
continue
}

# Delete the remote branch after successful merge
# TODO --delete branch1 branch2 branch3 etc
git push origin --delete "$branch"
echo "Deleted remote branch: $branch"
done

# Push changes using PAT
echo "Pushing changes to $CURRENT_BRANCH"
git push origin HEAD:$CURRENT_BRANCH || {
echo "Failed to push changes"
exit 1
}

- name: Create release
run: |
VERSION=${{ needs.prepare-release.outputs.release-version }}
git tag $VERSION
git push origin $VERSION

if [[ "$VERSION" == *"-rc."* ]]; then
gh release create "$VERSION" -t "$VERSION" --prerelease
else
gh release create "$VERSION" -t "$VERSION"
fi
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
push:
branches:
- main
pull_request: # Runs on pull requests to any branch
pull_request:

jobs:
determine-should-run-tests:
Expand Down
2 changes: 1 addition & 1 deletion dfx_extension/extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azle",
"version": "0.24.1",
"version": "0.24.2-rc.51",
"homepage": "https://github.com/dfinity/dfx-extensions",
"authors": "",
"summary": "",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azle",
"version": "0.25.0",
"version": "0.24.2-rc.51",
"description": "TypeScript and JavaScript CDK for the Internet Computer",
"scripts": {
"typecheck": "tsc --noEmit",
Expand Down
Loading