chore: run for a commit on main #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: temporary R2 bucket upload | |
# | |
#on: | |
# push: | |
# branches: | |
# - main | |
# workflow_dispatch: | |
# inputs: | |
# branch: | |
# description: Github branch to checkout for compilation | |
# required: true | |
# default: main | |
# type: string | |
# commit-hash: | |
# description: Commit hash to checkout | |
# required: false | |
# default: "" | |
# type: string | |
on: | |
push: | |
branches: | |
- feat/add-commit-hash-support-to-r2-action | |
jobs: | |
compile-and-upload: | |
name: Compile contracts and push to R2 | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
steps: | |
- name: Determine branch and commit hash | |
id: get-branch-and-commit | |
run: | | |
commit_hash="1ebaae763d2f78bae7f0cfc7efb7591a9885e3c9" | |
echo "branch=main" >> $GITHUB_OUTPUT | |
echo "commit_hash=$commit_hash" >> $GITHUB_OUTPUT | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: "0" | |
path: axelar-amplifier | |
submodules: recursive | |
ref: ${{ steps.get-branch-and-commit.outputs.branch }} | |
- name: Checkout specific commit if provided | |
run: | | |
cd axelar-amplifier | |
git checkout ${{ steps.get-branch-and-commit.outputs.commit_hash }} | |
- name: Compile amplifier contracts | |
id: compile-contracts | |
run: | | |
cd axelar-amplifier | |
docker run --rm -v "$(pwd)":/code \ | |
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ | |
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ | |
cosmwasm/optimizer:0.16.0 | |
commit_hash=$(git rev-parse --short HEAD) | |
cd .. | |
mkdir -p ./artifacts/$commit_hash/ | |
cp -R axelar-amplifier/artifacts/* ./artifacts/$commit_hash/ | |
echo "wasm-directory=./artifacts" >> $GITHUB_OUTPUT | |
- uses: ryand56/r2-upload-action@latest | |
with: | |
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} | |
r2-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_CF }} | |
r2-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_CF }} | |
r2-bucket: ${{ secrets.R2_BUCKET }} | |
source-dir: ${{ steps.compile-contracts.outputs.wasm-directory }} | |
destination-dir: ./pre-releases/ampd/contracts/ |