-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
127 additions
and
11 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
# common variable is defined in the workflow | ||
# repo env variable doesn't work for PR from forks | ||
env: | ||
CI_IMAGE: "paritytech/ci-unified:bullseye-1.81.0-2024-09-11-v202409111034" | ||
|
||
jobs: | ||
set-variables: | ||
# This workaround sets the container image for each job using 'set-variables' job output. | ||
# env variables don't work for PR from forks, so we need to use outputs. | ||
runs-on: ubuntu-latest | ||
outputs: | ||
CI_IMAGE: ${{ steps.set_image.outputs.CI_IMAGE }} | ||
VERSION: ${{ steps.version.outputs.VERSION }} | ||
steps: | ||
- name: Set image | ||
id: set_image | ||
run: echo "CI_IMAGE=${{ env.CI_IMAGE }}" >> $GITHUB_OUTPUT | ||
- name: Define version | ||
id: version | ||
run: | | ||
export COMMIT_SHA=${{ github.sha }} | ||
export COMMIT_SHA_SHORT=${COMMIT_SHA:0:8} | ||
export REF_NAME=${{ github.ref_name }} | ||
export REF_SLUG=${REF_NAME//\//_} | ||
if [[ ${REF_SLUG} == "master" ]] | ||
then | ||
VERSION=${REF_SLUG}-${COMMIT_SHA_SHORT} | ||
echo "VERSION=${REF_SLUG}-${COMMIT_SHA_SHORT}" >> $GITHUB_OUTPUT | ||
else | ||
VERSION=${REF_SLUG} | ||
echo "VERSION=${REF_SLUG}" >> $GITHUB_OUTPUT | ||
fi | ||
echo "set VERSION=${VERSION}" | ||
build: | ||
name: Build | ||
runs-on: parity-large | ||
needs: [set-variables] | ||
container: | ||
image: ${{ needs.set-variables.outputs.CI_IMAGE }} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and pack artifact | ||
run: | | ||
cargo fetch | ||
CARGO_NET_OFFLINE=true time cargo build --release --workspace | ||
mkdir -p ./artifacts | ||
strip ./target/release/substrate-relay | ||
mv -v ./target/release/substrate-relay ./artifacts/ | ||
mv -v ./deployments/local-scripts/bridge-entrypoint.sh ./artifacts/ | ||
mv -v ./ci.Dockerfile ./artifacts/ | ||
- name: upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build | ||
path: ./artifacts | ||
retention-days: 2 | ||
|
||
build_push_docker: | ||
name: Build docker image | ||
runs-on: ubuntu-latest | ||
needs: [set-variables, build] | ||
env: | ||
VERSION: ${{ needs.set-variables.outputs.VERSION }} | ||
steps: | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build | ||
- name: Make scripts executable | ||
run: | | ||
chmod +x bridge-entrypoint.sh | ||
chmod +x substrate-relay | ||
- name: Build Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./ci.Dockerfile | ||
push: true | ||
tags: | | ||
docker.io/paritytech/substrate-relay:${{ env.VERSION }} | ||
docker.io/paritytech/bridges-common-relay:${{ env.VERSION }} | ||
deploy-westend: | ||
name: Deploy Westend | ||
runs-on: ubuntu-latest | ||
environment: parity-testnet | ||
needs: [set-variables, build_push_docker] | ||
env: | ||
VERSION: ${{ needs.set-variables.outputs.VERSION }} | ||
ARGOCD_SERVER: "westend-argocd.teleport.parity.io" | ||
steps: | ||
- name: Deploy to ArgoCD | ||
uses: paritytech/argocd-deployment-action@main | ||
with: | ||
environment: "parity-testnet" | ||
tag: "${{ env.VERSION }}" | ||
app_name: "bridges-common-relay" | ||
app_packages: "headers-a,headers-b,parachains-a,parachains-b,messages-a,messages-b" | ||
argocd_server: ${{ env.ARGOCD_SERVER }} | ||
teleport_token: ${{ env.APP }} | ||
teleport_app_name: "argocd-testnet" | ||
argocd_auth_token: ${{ secrets.ARGOCD_AUTH_TOKEN }} |