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

Fix releases #49

Merged
merged 46 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8f12104
Stop the release action from doing anything
bitdivine Feb 29, 2024
dfd828a
Fix double-v
bitdivine Mar 1, 2024
66cf992
Add workflow dispatch
bitdivine Mar 1, 2024
4a46b3d
Get idl2json version
bitdivine Mar 1, 2024
77173d5
++
bitdivine Mar 1, 2024
6a4d721
Make build depend on parameter colelction
bitdivine Mar 1, 2024
2c3d60c
fix
bitdivine Mar 1, 2024
c6df0e1
++
bitdivine Mar 1, 2024
4d1bf9c
++
bitdivine Mar 1, 2024
0e93a3a
fix
bitdivine Mar 1, 2024
b4d2399
Bump checkkout to v4
bitdivine Mar 1, 2024
2f92ed4
Merge remote-tracking branch 'origin/main' into fix-releases
bitdivine Mar 1, 2024
ba1d550
Merge remote-tracking branch 'origin/main' into fix-releases
bitdivine Mar 4, 2024
7a97fca
Don't run on push. Dispatch only.
bitdivine Mar 4, 2024
9a45386
fix
bitdivine Mar 4, 2024
f0847c2
Defautt to nothingh
bitdivine Mar 4, 2024
9336903
Check whether the git tag already exists and poinmts to a different
bitdivine Mar 4, 2024
b5a50a8
Create tag
bitdivine Mar 4, 2024
1408714
Fetch tags
bitdivine Mar 4, 2024
5d817a2
Fetch all commits and tags
bitdivine Mar 4, 2024
971f3f2
Print a workflow-level error message
bitdivine Mar 4, 2024
686d293
Try fix
bitdivine Mar 4, 2024
983c548
Create a draft release
bitdivine Mar 4, 2024
e026373
fix
bitdivine Mar 4, 2024
a265929
Improve: The action is deprecated. Use the gh cli instead.
bitdivine Mar 4, 2024
c5f1256
provide a gh token
bitdivine Mar 4, 2024
39209da
Better messaging
bitdivine Mar 4, 2024
7c77b0c
Create builds
bitdivine Mar 4, 2024
8646d73
Fix tag name
bitdivine Mar 4, 2024
5dffe16
Don't publish when uploading assets
bitdivine Mar 4, 2024
5b320fe
Create release notes
bitdivine Mar 4, 2024
e32769d
Fix upload assets
bitdivine Mar 4, 2024
dcf7081
Print to get early warning
bitdivine Mar 4, 2024
33ae9df
fix: Make the git tag available as a job var
bitdivine Mar 4, 2024
a1bcee1
Fix rust
bitdivine Mar 4, 2024
106b463
Lock cargo when publishing
bitdivine Mar 4, 2024
dde1442
Fix rust
bitdivine Mar 4, 2024
eeae9e4
Add a dry run early on
bitdivine Mar 4, 2024
48b150c
Update rust
bitdivine Mar 4, 2024
91e400a
Use a workspace version
bitdivine Mar 4, 2024
3442189
Ignore publishing the cli fro now
bitdivine Mar 4, 2024
ad156f5
Update cargo.lock
bitdivine Mar 4, 2024
af6dc54
++
bitdivine Mar 4, 2024
ac5ee45
Delete old release script
bitdivine Mar 4, 2024
600b6db
Publish for real
bitdivine Mar 4, 2024
44a27b8
clippy
bitdivine Mar 4, 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
77 changes: 70 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,75 @@
name: Release
on:
workflow_dispatch:
inputs:
prerelease:
description: |
The semantic version pre-release string.
E.g. in `v1.2.3-beta.2` the pre-release string is `beta.3`.
required: false
push:
tags:
- "*"
defaults:
run:
shell: bash
jobs:
setup:
name: Get release parameters
outputs:
SEMANTIC_VERSION: ${{ steps.params.outputs.SEMANTIC_VERSION }}
GIT_TAG: ${{ steps.params.outputs.GIT_TAG }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Get release parameters
id: params
run: |
# Get the release version:
IDL2JSON_CARGO_VERSION="$(cargo metadata --locked | jq -r '.packages[] | select(.name == "idl2json") | .version')"
PRERELEASE="${{ github.event.inputs.prerelease }}"
SEMANTIC_VERSION="${IDL2JSON_CARGO_VERSION}${PRERELEASE:+-}${PRERELEASE}"
GIT_TAG="v$SEMANTIC_VERSION"
(
for var in IDL2JSON_CARGO_VERSION PRERELEASE SEMANTIC_VERSION GIT_TAG ; do
echo "$var=${!var}"
done
) | tee -a $GITHUB_OUTPUT
- name: Dry run
run: cargo publish -p idl2json --dry-run --locked
- name: Tag this commit
run: |
GIT_TAG=${{ steps.params.outputs.GIT_TAG }}
# Tag this commit, if it not already tagged. Also, verifty that the tag isn't on a different commit.
if COMMIT="$(git show-ref "refs/tags/$GIT_TAG")" ; then
if [[ "$GIT_TAG" == "$GITHUB_SHA" ]]
then echo "Tag $GIT_TAG already exists on this commit."
else echo "::error::Tag $GIT_TAG already exists and points to a different commit."
exit 1
fi
else
echo "Tagging commit $GITHUB_SHA with $GIT_TAG..."
git tag "$GIT_TAG"
git push origin "refs/tags/$GIT_TAG"
fi
- name: Create a draft release
run: |
GIT_TAG=${{ steps.params.outputs.GIT_TAG }}
if gh release view "$GIT_TAG" ; then
echo "Release $GIT_TAG already exists."
else
echo "Creating release $GIT_TAG..."
for pkg in idl2json candid yaml2candid ; do cargo metadata --locked --format-version 1 | pkg="$pkg" jq -r '.packages[] | select(.name == env.pkg) | "\(env.pkg): \(.version)"' ; done > release_notes.txt
gh release create "$GIT_TAG" --title "Release $GIT_TAG" --draft --verify-tag --notes-file release_notes.txt
fi
env:
GH_TOKEN: ${{ github.token }}
build:
name: Release binary for ${{ matrix.name }}
needs: setup
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -44,6 +105,8 @@ jobs:
# make_target: unused
# rust: 1.60.0
steps:
- name: Notification
run: echo "::notice::Building ${{ matrix.asset_name }} for release ${{ needs.setup.outputs.GIT_TAG }}..."
- uses: actions/checkout@v4
# BUILD
- name: Static build with musl
Expand Down Expand Up @@ -84,11 +147,11 @@ jobs:
run: cp "${{ matrix.asset_name }}" "${{ matrix.old_name }}"
# UPLOAD
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "${{ matrix.asset_name }}"
tag: "v${{ github.ref }}"
run: |
echo "Uploading ${{ matrix.asset_name }} to ${{ needs.setup.outputs.GIT_TAG }}..."
gh release upload "${{ needs.setup.outputs.GIT_TAG }}" "${{ matrix.asset_name }}"
env:
GH_TOKEN: ${{ github.token }}
publish_idl2json:
needs: build
name: Publish idl2json to crates.io
Expand All @@ -103,7 +166,7 @@ jobs:
- name: Publish ${{ matrix.package }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p "${{ matrix.package }}"
run: cargo publish -p "${{ matrix.package }}" --locked
publish_idl2json_cli:
needs: publish_idl2json
name: Publish idl2json_cli to crates.io
Expand All @@ -118,4 +181,4 @@ jobs:
- name: Publish ${{ matrix.package }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p "${{ matrix.package }}"
run: cargo publish -p "${{ matrix.package }}" --locked
10 changes: 5 additions & 5 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ members = [

resolver = "2"

[workspace.package]
# Note: On update, please also update the dependency versions in src/*_cli/Cargo.toml
version = "0.9.3-alpha.1"

[workspace.dependencies]
candid = "0.9.0"
candid = { version = "0.9.0", features = ["parser"] }
146 changes: 0 additions & 146 deletions scripts/release.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/idl2json/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "idl2json"
version = "0.9.3"
version = { workspace = true }
authors = ["dfinity <sdk@dfinity.org>"]
edition = "2018"
description = "Converts the candid interface description language to JSON."
Expand Down
4 changes: 2 additions & 2 deletions src/idl2json_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "idl2json_cli"
version = "0.9.3"
version = { workspace = true }
authors = ["dfinity <sdk@dfinity.org>"]
edition = "2021"
description = "Converts the candid interface description language to JSON."
Expand All @@ -24,7 +24,7 @@ candid = { workspace = true }
clap = { version = "3.1.6", features = [ "derive" ] }
fn-error-context = "0.2.1"
serde_json = "^1.0"
idl2json = { path = "../idl2json", version = "0.9.3", features = ["clap", "crypto"] }
idl2json = { path = "../idl2json", version="0.9.3-alpha.1", features = ["clap", "crypto"] }
anyhow = "1"

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/yaml2candid/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yaml2candid"
version = "0.9.3"
version = { workspace = true }
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
4 changes: 2 additions & 2 deletions src/yaml2candid_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "yaml2candid_cli"
version = "0.9.3"
version = { workspace = true }
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "3.1.6", features = [ "derive" ] }
yaml2candid = { path = "../yaml2candid", version = "0.9.3" }
yaml2candid = { path = "../yaml2candid", version = "0.9.3-alpha.1" }

[build-dependencies]
toml = "0.5.9"
Loading