Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1869f21
XC-284: use canlog from crates.io
gregorydemay Apr 29, 2025
ad9b7ac
XC-284: remove canlog
gregorydemay Apr 29, 2025
02de0db
Merge branch 'main' into gdemay/XC-284-remove-local-canlog
gregorydemay Apr 29, 2025
abfc65d
Merge branch 'main' into gdemay/XC-284-remove-local-canlog
gregorydemay Apr 29, 2025
9c2ce55
XC-284: remove canlog_derive and canlog from release-plz config
gregorydemay Apr 29, 2025
0c67c85
XC-284: Publish release
gregorydemay Apr 29, 2025
71beff5
XC-284: register workflow
gregorydemay Apr 29, 2025
1e97065
Revert "XC-284: register workflow"
gregorydemay Apr 29, 2025
6f113cc
XC-284: try Github release
gregorydemay Apr 29, 2025
99e9c3b
XC-284: single Git tag
gregorydemay Apr 29, 2025
94c0ad6
XC-284: find previous artifact
gregorydemay Apr 29, 2025
0ae96c4
XC-284: add assets to Release
gregorydemay Apr 29, 2025
dd54159
Merge branch 'main' into gdemay/XC-284-publish
gregorydemay Apr 29, 2025
c6d52b7
XC-284: remove condition
gregorydemay Apr 29, 2025
988a384
XC-284: set tag_name
gregorydemay Apr 29, 2025
39d726c
XC-284: read tag from release-plz
gregorydemay Apr 29, 2025
6a95d7c
XC-284: select correct tag
gregorydemay Apr 29, 2025
d6ec766
XC-284: update Cargo dependencies upon PR
gregorydemay Apr 29, 2025
5d2819e
XC-284: Github release body
gregorydemay Apr 29, 2025
2276bab
XC-284: parse changelog
gregorydemay Apr 29, 2025
aafcc15
XC-284: fix
gregorydemay Apr 29, 2025
b1d4dcc
XC-284: clean-up
gregorydemay Apr 29, 2025
fa8fee5
XC-284: use specified commit for testing
gregorydemay Apr 29, 2025
f700e7c
Revert "XC-284: use specified commit for testing"
gregorydemay Apr 29, 2025
a4eba83
Merge branch 'main' into gdemay/XC-284-publish
gregorydemay Apr 29, 2025
35fc55a
XC-284: enable Cargo publish
gregorydemay Apr 29, 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
112 changes: 112 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Publish

on:
workflow_dispatch

jobs:
# Release unpublished packages.
release-plz-release:
name: Publish artifacts
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
concurrency:
group: publish
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Download build for Release Candidate"
# Adapted from [Internet Identity](https://github.com/dfinity/internet-identity/blob/c33e9f65a8045cbedde6f96cfb7f7cb677694fc9/.github/workflows/deploy-rc.yml#L22)
uses: actions/github-script@v7
with:
script: |
// Find all artifacts for the production build, and filter for non-expired main artifacts
const allArtifacts = await github.paginate(github.rest.actions.listArtifactsForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
name: "sol_rpc_canister.wasm.gz",
});
const artifactsByBranch = {};
const mainArtifacts = allArtifacts
.filter(artifact => !artifact.expired)
.filter(artifact => artifact.workflow_run.head_branch === "main");

// Grab the latest artifact
mainArtifacts.sort((a,b) => new Date(b.updated_at) - new Date(a.updated_at));
const latestMainArtifact = mainArtifacts[0];
if(!latestMainArtifact) {
const message = "Could not find an artifact to deploy from branch main, are artifacts expired?";
console.error(message);
throw new Error(message);
}
console.log("found artifact for commit", latestMainArtifact.workflow_run.head_sha);

// Download and unzip artifact
const { url } = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: latestMainArtifact.id,
archive_format: "zip",
});
await exec.exec('curl', ['-sSL', url, '-o', "artifact.zip"]);
await exec.exec('unzip', ["artifact.zip" ]);
await exec.exec('rm', ["artifact.zip" ]);

- name: "SHA256 of release asset"
run: |
set -e
SHA256=$(shasum -a 256 ./sol_rpc_canister.wasm.gz | cut -d ' ' -f1)
echo "SHA256 of sol_rpc_canister.wasm.gz: $SHA256"
echo "SOL_RPC_CANISTER_WASM_GZ_SHA256=$SHA256" >> "$GITHUB_ENV"

- name: "Install parse-changelog"
uses: taiki-e/install-action@parse-changelog

- name: "Run release-plz"
id: release-plz
uses: release-plz/action@bbd1afc9813d25602e002b29e96e0aacebab1160 # v0.5.105
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

- name: "Generate Github release body"
env:
RELEASES: ${{ steps.release-plz.outputs.releases }}
RELEASES_CREATED: ${{ steps.release-plz.outputs.releases_created }}
run: |
set -e
echo "releases: $RELEASES" # example: [{"package_name":"my-package","prs":[{"html_url":"https://github.com/user/proj/pull/1439","number":1439}],"tag":"v0.1.0","version":"0.1.0"}]
echo "releases_created: $RELEASES_CREATED" # example: true

release_tag=$(echo "$RELEASES" | jq -r '.[] | select(.package_name == "sol_rpc_canister") | .tag')
echo "release_tag: $release_tag"
echo "RELEASE_TAG=$release_tag" >> "$GITHUB_ENV"

release_version=$(echo "$RELEASES" | jq -r '.[] | select(.package_name == "sol_rpc_canister") | .version')
echo "release_version: $release_version"
echo "RELEASE_VERSION=$release_version" >> "$GITHUB_ENV"

echo "- SHA-256 hash: ${{ env.SOL_RPC_CANISTER_WASM_GZ_SHA256}}" >> ${{ github.workspace }}-RELEASE.txt
echo "" >> ${{ github.workspace }}-RELEASE.txt
echo "## What's Changed" >> ${{ github.workspace }}-RELEASE.txt
echo "" >> ${{ github.workspace }}-RELEASE.txt

notes=$(parse-changelog canister/CHANGELOG.md "$release_version")
echo "$notes" >> ${{ github.workspace }}-RELEASE.txt

- name: "Create Github release"
uses: softprops/action-gh-release@v2
with:
draft: true
tag_name: ${{ env.RELEASE_TAG}}
body_path: ${{ github.workspace }}-RELEASE.txt
files: |
sol_rpc_canister.wasm.gz
canister/sol_rpc_canister.did
27 changes: 20 additions & 7 deletions release-plz.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ changelog_update = true
# update dependencies with `cargo update`
dependencies_update = true

# create tags for the releases
git_tag_enable = true
# Disable git releases for all packages by default
git_release_enable = false

# enable GitHub releases
git_release_enable = true
# Disable git tags for all packages by default
git_tag_enable = false

# creates the git release as draft
git_release_draft = true
Expand All @@ -31,9 +31,22 @@ publish_allow_dirty = false

[[package]] # the double square brackets define a TOML table array
name = "sol_rpc_canister"
changelog_update = true # enable changelog update for `package_a`
git_release_enable = true # enable GitHub/Gitea releases for `package_a`
publish = false # disable `cargo publish` for `package_a`
# Customize the git tag name.
# Setting for single git tag, see https://release-plz.dev/docs/extra/single-tag
git_tag_name = "v{{ version }}"
# Enable git tags for this package
git_tag_enable = true
publish = false # disable `cargo publish`

[[package]] # the double square brackets define a TOML table array
name = "sol_rpc_client"
#git_release_enable = false # enable GitHub releases
publish = true # enable `cargo publish`

[[package]] # the double square brackets define a TOML table array
name = "sol_rpc_types"
#git_release_enable = false # enable GitHub releases
publish = true # enable `cargo publish`

[[package]]
name = "basic_solana"
Expand Down