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

Add GitHub actions workflow to create a release when pushing a release tag #39

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Changes from all commits
Commits
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
99 changes: 99 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
on:
push:
tags:
- 'release-*'

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/cache@v4
id: cache
with:
path: |
~/.cargo
target
key: cargo-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
restore-keys: cargo-

- name: Install ic-wasm
run: cargo install ic-wasm --version 0.3.5

- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: 'Build Issuer'
run: ./dummy-issuer/build.sh

- name: 'Build Relying Party'
run: ./dummy-relying-party/build.sh

- name: Create Release
uses: actions/github-script@v7
id: create-release
with:
result-encoding: string
script: |
const response = await github.rest.repos.createRelease({
owner: "dfinity",
repo: "verifiable-credentials-sdk",
tag_name: "${{ github.ref_name }}",
name: "${{ github.ref_name }}",
body: "Please see the [changelog](https://github.com/dfinity/verifiable-credentials-sdk/blob/main/CHANGELOG.md#${{ github.ref_name }}) for the detailed changes.",
draft: true,
prerelease: false,
generate_release_notes: false,
});
return response.data.id;

- name: Upload Issuer Wasm

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need more artifacts being uploaded (or need it in other places), then I'll extract a custom action for it...

uses: actions/github-script@v7
with:
script: |
await github.rest.repos.uploadReleaseAsset({
owner: "dfinity",
repo: "verifiable-credentials-sdk",
release_id: ${{ steps.create-release.outputs.result }},
name: "dummy_issuer.wasm.gz",
data: require('fs').readFileSync('./dummy-issuer/dummy_issuer.wasm.gz'),
});

- name: Upload Issuer Interface
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.uploadReleaseAsset({
owner: "dfinity",
repo: "verifiable-credentials-sdk",
release_id: ${{ steps.create-release.outputs.result }},
name: "dummy_issuer.did",
data: require('fs').readFileSync('./dummy-issuer/dummy_issuer.did'),
});

- name: Upload Relying Party Wasm
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.uploadReleaseAsset({
owner: "dfinity",
repo: "verifiable-credentials-sdk",
release_id: ${{ steps.create-release.outputs.result }},
name: "dummy_relying_party.wasm.gz",
data: require('fs').readFileSync('./dummy-relying-party/dummy_relying_party.wasm.gz'),
});

- name: Upload Relying Party Interface
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.uploadReleaseAsset({
owner: "dfinity",
repo: "verifiable-credentials-sdk",
release_id: ${{ steps.create-release.outputs.result }},
name: "dummy_relying_party.did",
data: require('fs').readFileSync('./dummy-relying-party/dummy_relying_party.did'),
});
Loading