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

ci: add ability to upload wasm artefacts based on release hash #100

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
55 changes: 55 additions & 0 deletions .github/workflows/release-hash.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# takes the latest commit hash on main and uploads the artefacts to CF storage
name: Release
on:
workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
define-matrix:
runs-on: blacksmith-2vcpu-ubuntu-2204

outputs:
releases: ${{ steps.prepare-matrix.outputs.releases }}

steps:
- name: Prepare JSON output to be a matrix GHA format
id: prepare-matrix
run: |
# -J for json, -d for directories, -L 1 for depth of 1
export NAMES=$(tree -J -d -L 1 contracts | jq -c '.[0].contents | map(.name)')
echo "releases=$NAMES" >> $GITHUB_OUTPUT

# Publishes a release in case the release isn't published
build-and-upload:
name: Publish releases

runs-on: blacksmith-2vcpu-ubuntu-2204
needs: define-matrix

strategy:
matrix:
releases: ${{ fromJson(needs.define-matrix.outputs.releases) }}

uses: ./.github/workflows/reusable-build-upload.yaml
permissions:
id-token: write
contents: read
with:
package-name: "${{ matrix.releases.package_name }}"
package-version: "${{ github.sha }}"

# CF Bucket related variables
cf-bucket-name: "${{ vars.CF_BUCKET_NAME }}"

# The root key to be used for accessing the configs. (ex: `test-root-key` puts releases in `test-root-key/*`)
cf-config-bucket-root-key: "${{ vars.CF_BUCKET_ROOT_KEY }}"

# we just want to upload to CF, do not run a github release
github-release: "false"
ahramy marked this conversation as resolved.
Show resolved Hide resolved

secrets:
github-token: "${{ secrets.PAT_TOKEN }}"
cf-endpoint-url: "${{ secrets.CF_ENDPOINT_URL }}"
cf-bucket-access-key-id: ${{ secrets.CF_BUCKET_ACCESS_KEY_ID }}
cf-bucket-secret-access-key: ${{ secrets.CF_BUCKET_SECRET_ACCESS_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/reusable-build-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ on:
required: true
type: string

github-release:
description: "Whether to upload the build as a github release"
required: false
default: "true"
ahramy marked this conversation as resolved.
Show resolved Hide resolved
type: boolean

secrets:
github-token:
description: "The github token to use to do the tag updates"
Expand Down Expand Up @@ -176,6 +182,7 @@ jobs:
# https://github.com/orgs/community/discussions/26263#discussioncomment-3251069
- name: Update the GitHub Release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
if: ${{ inputs.github-release == 'true' }}
with:
tag_name: ${{ inputs.package-git-tag }} # This uses the tag from the push
files: |
Expand Down
Loading