2023-04-03 13:53:50 +00:00
|
|
|
name: (CD) Publish docker + s3
|
2022-08-30 08:53:27 +00:00
|
|
|
|
2023-03-24 15:42:33 +00:00
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
projects:
|
|
|
|
required: true
|
|
|
|
type: string
|
2022-08-30 08:53:27 +00:00
|
|
|
|
|
|
|
jobs:
|
2023-04-03 13:53:50 +00:00
|
|
|
publish-dist:
|
2022-08-30 08:53:27 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-03-24 15:42:33 +00:00
|
|
|
app: ${{ fromJSON(inputs.projects) }}
|
|
|
|
name: ${{ matrix.app }}
|
2023-04-03 13:53:50 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2023-04-20 11:56:33 +00:00
|
|
|
timeout-minutes: 25
|
2022-08-30 08:53:27 +00:00
|
|
|
steps:
|
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v3
|
2023-06-27 09:18:13 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
2022-08-30 08:53:27 +00:00
|
|
|
|
2023-07-12 15:37:49 +00:00
|
|
|
- name: Init variables
|
|
|
|
run: |
|
|
|
|
echo IS_PR=false >> $GITHUB_ENV
|
|
|
|
echo IS_MAINNET_RELEASE=false >> $GITHUB_ENV
|
|
|
|
echo IS_TESTNET_RELEASE=false >> $GITHUB_ENV
|
|
|
|
echo IS_IPFS_RELEASE=false >> $GITHUB_ENV
|
2023-07-19 14:42:47 +00:00
|
|
|
echo IS_S3_RELEASE=false >> $GITHUB_ENV
|
2023-08-02 08:58:17 +00:00
|
|
|
echo IS_DEV_IMAGE=false >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Is dev image
|
|
|
|
if: ${{ contains(github.ref, 'develop') && github.event_name == 'push' && matrix.app == 'trading' }}
|
|
|
|
run: |
|
|
|
|
echo IS_DEV_IMAGE=true >> $GITHUB_ENV
|
2023-07-12 15:37:49 +00:00
|
|
|
|
|
|
|
- name: Is PR
|
2023-07-13 09:19:37 +00:00
|
|
|
if: ${{ github.event_name == 'pull_request' }}
|
2023-07-12 15:37:49 +00:00
|
|
|
run: |
|
|
|
|
echo IS_PR=true >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Is mainnet release
|
2023-07-31 11:07:25 +00:00
|
|
|
if: ${{ contains(github.ref, 'release/mainnet') && !contains(github.ref, 'mirror') }}
|
2023-07-12 15:37:49 +00:00
|
|
|
run: |
|
|
|
|
echo IS_MAINNET_RELEASE=true >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Is testnet release
|
|
|
|
if: ${{ contains(github.ref, 'release/testnet') }}
|
|
|
|
run: |
|
|
|
|
echo IS_TESTNET_RELEASE=true >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Is IPFS Release
|
|
|
|
if: ${{ matrix.app == 'trading' && github.event_name == 'push' && ( env.IS_MAINNET_RELEASE == 'true' || env.IS_TESTNET_RELEASE == 'true' ) }}
|
|
|
|
run: |
|
|
|
|
echo IS_IPFS_RELEASE=true >> $GITHUB_ENV
|
|
|
|
|
2023-07-14 11:45:06 +00:00
|
|
|
- name: Is S3 Release
|
2023-07-19 14:42:47 +00:00
|
|
|
if: ${{ env.IS_IPFS_RELEASE == 'false' && github.event_name == 'push' }}
|
2023-07-14 11:45:06 +00:00
|
|
|
run: |
|
2023-07-19 14:42:47 +00:00
|
|
|
echo IS_S3_RELEASE=true >> $GITHUB_ENV
|
2023-07-14 11:45:06 +00:00
|
|
|
|
2022-08-30 08:53:27 +00:00
|
|
|
- name: Set up QEMU
|
|
|
|
id: quemu
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
|
|
|
|
- name: Available platforms
|
|
|
|
run: echo ${{ steps.qemu.outputs.platforms }}
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
2023-05-09 16:24:39 +00:00
|
|
|
- name: Log in to the Container registry (ghcr)
|
2023-07-12 15:37:49 +00:00
|
|
|
if: ${{ env.IS_PR == 'true' }}
|
2023-04-03 13:53:50 +00:00
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-05-09 16:24:39 +00:00
|
|
|
- name: Log in to the Container registry (docker hub)
|
|
|
|
uses: docker/login-action@v2
|
2023-08-02 08:58:17 +00:00
|
|
|
if: ${{ env.IS_IPFS_RELEASE == 'true' || env.IS_DEV_IMAGE == 'true' }}
|
2023-05-09 16:24:39 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
2023-04-14 09:47:41 +00:00
|
|
|
- name: Setup node
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version-file: '.nvmrc'
|
|
|
|
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
|
|
|
|
cache: yarn
|
|
|
|
|
|
|
|
- name: Cache node modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: node_modules
|
|
|
|
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
|
|
|
|
|
2023-03-23 09:50:23 +00:00
|
|
|
# https://docs.github.com/en/actions/learn-github-actions/contexts
|
2023-05-23 09:20:45 +00:00
|
|
|
- name: Define dist variables
|
|
|
|
if: ${{ github.event_name == 'push' }}
|
2022-08-30 08:53:27 +00:00
|
|
|
run: |
|
2023-07-26 14:08:57 +00:00
|
|
|
python3 tools/ci/define-dist-variables.py --github-ref="${{ github.ref }}" --app="${{ matrix.app }}"
|
|
|
|
|
|
|
|
- name: Verify script result
|
|
|
|
if: ${{ github.event_name == 'push' }}
|
|
|
|
run: |
|
|
|
|
echo "BUCKET_NAME=${{ env.BUCKET_NAME }}"
|
|
|
|
echo "ENV_NAME=${{ env.ENV_NAME }}"
|
2023-04-14 09:47:41 +00:00
|
|
|
|
|
|
|
- name: Build local dist
|
|
|
|
run: |
|
2023-07-04 11:01:25 +00:00
|
|
|
envCmd=""
|
2023-04-14 09:47:41 +00:00
|
|
|
if [[ ! -z "${{ env.ENV_NAME }}" ]]; then
|
2023-07-04 11:01:25 +00:00
|
|
|
envCmd="yarn env-cmd -f ./apps/${{ matrix.app }}/.env.${{ env.ENV_NAME }}"
|
2023-04-14 09:47:41 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${{ matrix.app }}" = "trading" ]; then
|
2023-07-04 11:01:25 +00:00
|
|
|
$envCmd yarn nx export trading || (yarn install && $envCmd yarn nx export trading)
|
2023-04-14 09:47:41 +00:00
|
|
|
DIST_LOCATION=dist/apps/trading/exported
|
2023-06-14 10:37:41 +00:00
|
|
|
elif [ "${{ matrix.app }}" = "ui-toolkit" ]; then
|
|
|
|
NODE_ENV=production yarn nx run ui-toolkit:build-storybook
|
|
|
|
DIST_LOCATION=dist/storybook/ui-toolkit
|
2023-07-27 11:52:00 +00:00
|
|
|
elif [ "${{ matrix.app }}" = "static" ]; then
|
|
|
|
yarn nx build static || (yarn install && yarn nx build static)
|
2023-04-14 09:47:41 +00:00
|
|
|
else
|
2023-07-04 11:01:25 +00:00
|
|
|
$envCmd yarn nx build ${{ matrix.app }} || (yarn install && $envCmd yarn nx build ${{ matrix.app }})
|
2023-07-27 11:52:00 +00:00
|
|
|
fi
|
|
|
|
if [[ -z "$DIST_LOCATION" ]]; then
|
2023-04-14 09:47:41 +00:00
|
|
|
DIST_LOCATION=dist/apps/${{ matrix.app }}
|
|
|
|
fi
|
|
|
|
mv $DIST_LOCATION dist-result
|
|
|
|
tree dist-result
|
2022-08-30 08:53:27 +00:00
|
|
|
|
|
|
|
- name: Build and export to local Docker
|
2023-04-03 13:53:50 +00:00
|
|
|
id: docker_build
|
2022-08-30 08:53:27 +00:00
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
2023-04-14 09:47:41 +00:00
|
|
|
context: .
|
2023-05-09 16:24:39 +00:00
|
|
|
file: docker/node-outside-docker.Dockerfile
|
2023-03-24 15:42:33 +00:00
|
|
|
load: true
|
2023-03-23 09:50:23 +00:00
|
|
|
build-args: |
|
|
|
|
APP=${{ matrix.app }}
|
2023-04-14 09:47:41 +00:00
|
|
|
ENV_NAME=${{ env.ENV_NAME }}
|
2023-03-23 09:50:23 +00:00
|
|
|
tags: |
|
|
|
|
ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local
|
2022-08-30 08:53:27 +00:00
|
|
|
|
2023-04-14 13:45:14 +00:00
|
|
|
- name: Image digest
|
2023-07-12 15:37:49 +00:00
|
|
|
if: ${{ env.IS_PR == 'true' }}
|
2023-04-14 13:45:14 +00:00
|
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
|
|
|
|
2022-08-30 08:53:27 +00:00
|
|
|
- name: Sanity check docker image
|
|
|
|
run: |
|
2023-03-23 09:50:23 +00:00
|
|
|
echo "Check ipfs-hash"
|
2023-05-09 16:24:39 +00:00
|
|
|
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local cat /ipfs-hash
|
2023-05-10 11:21:53 +00:00
|
|
|
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local cat /ipfs-hash > ${{ matrix.app }}-ipfs-hash
|
2023-03-23 09:50:23 +00:00
|
|
|
echo "List html directory"
|
2023-05-09 16:24:39 +00:00
|
|
|
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local sh -c 'apk add --update tree; tree /usr/share/nginx/html'
|
2023-03-23 09:50:23 +00:00
|
|
|
|
2023-05-09 16:24:39 +00:00
|
|
|
- name: Publish dist as docker image (ghcr)
|
2022-08-30 08:53:27 +00:00
|
|
|
uses: docker/build-push-action@v3
|
2023-06-14 10:37:41 +00:00
|
|
|
continue-on-error: true
|
|
|
|
id: ghcr-push
|
2023-07-12 15:37:49 +00:00
|
|
|
if: ${{ env.IS_PR == 'true' }}
|
2022-08-30 08:53:27 +00:00
|
|
|
with:
|
2023-04-14 09:47:41 +00:00
|
|
|
context: .
|
2023-05-09 16:24:39 +00:00
|
|
|
file: docker/node-outside-docker.Dockerfile
|
2023-03-23 09:50:23 +00:00
|
|
|
push: true
|
|
|
|
build-args: |
|
|
|
|
APP=${{ matrix.app }}
|
2023-04-14 09:47:41 +00:00
|
|
|
ENV_NAME=${{ env.ENV_NAME }}
|
2022-08-30 08:53:27 +00:00
|
|
|
tags: |
|
2023-04-03 13:53:50 +00:00
|
|
|
ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
|
2023-05-09 16:24:39 +00:00
|
|
|
- name: Publish dist as docker image (docker hub)
|
|
|
|
uses: docker/build-push-action@v3
|
2023-06-14 10:37:41 +00:00
|
|
|
continue-on-error: true
|
|
|
|
id: dockerhub-push
|
2023-08-02 08:58:17 +00:00
|
|
|
if: ${{ env.IS_IPFS_RELEASE == 'true' || env.IS_DEV_IMAGE == 'true' }}
|
2023-05-09 16:24:39 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/node-outside-docker.Dockerfile
|
2023-06-14 10:37:41 +00:00
|
|
|
push: true
|
|
|
|
build-args: |
|
|
|
|
APP=${{ matrix.app }}
|
|
|
|
ENV_NAME=${{ env.ENV_NAME }}
|
|
|
|
tags: |
|
2023-06-15 16:03:59 +00:00
|
|
|
vegaprotocol/${{ matrix.app }}:${{ github.sha }}
|
2023-08-02 08:58:17 +00:00
|
|
|
vegaprotocol/${{ matrix.app }}:${{ env.IS_MAINNET_RELEASE == 'true' && 'mainnet' || env.IS_TESTNET_RELEASE == 'true' && 'testnet' || env.IS_DEV_IMAGE == 'true' && 'develop' || '' }}
|
2023-06-14 10:37:41 +00:00
|
|
|
|
|
|
|
- name: Publish dist as docker image (ghcr - retry)
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
if: ${{ steps.ghcr-push.outcome == 'failure' }}
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/node-outside-docker.Dockerfile
|
|
|
|
push: true
|
|
|
|
build-args: |
|
|
|
|
APP=${{ matrix.app }}
|
|
|
|
ENV_NAME=${{ env.ENV_NAME }}
|
|
|
|
tags: |
|
|
|
|
ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
|
|
|
|
- name: Publish dist as docker image (docker hub - retry)
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
if: ${{ steps.dockerhub-push.outcome == 'failure' }}
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: docker/node-outside-docker.Dockerfile
|
2023-05-09 16:24:39 +00:00
|
|
|
push: true
|
|
|
|
build-args: |
|
|
|
|
APP=${{ matrix.app }}
|
|
|
|
ENV_NAME=${{ env.ENV_NAME }}
|
|
|
|
tags: |
|
2023-06-15 16:03:59 +00:00
|
|
|
vegaprotocol/${{ matrix.app }}:${{ github.sha }}
|
2023-07-12 15:37:49 +00:00
|
|
|
vegaprotocol/${{ matrix.app }}:${{ env.IS_MAINNET_RELEASE == 'true' && 'mainnet' || env.IS_TESTNET_RELEASE == 'true' && 'testnet' || '' }}
|
2023-05-09 16:24:39 +00:00
|
|
|
|
2023-04-12 07:38:26 +00:00
|
|
|
# bucket creation in github.com/vegaprotocol/terraform//frontend
|
|
|
|
- name: Publish dist to s3
|
|
|
|
uses: jakejarvis/s3-sync-action@master
|
2023-06-15 16:03:59 +00:00
|
|
|
# s3 releases are not happening for trading on mainnet - it's IPFS
|
2023-07-19 14:42:47 +00:00
|
|
|
if: ${{ env.IS_S3_RELEASE == 'true' }}
|
2023-04-12 07:38:26 +00:00
|
|
|
with:
|
|
|
|
args: --acl private --follow-symlinks --delete
|
|
|
|
env:
|
2023-04-14 13:00:20 +00:00
|
|
|
AWS_S3_BUCKET: ${{ env.BUCKET_NAME }}
|
2023-04-12 07:38:26 +00:00
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
AWS_REGION: 'eu-west-1'
|
2023-04-14 13:45:14 +00:00
|
|
|
SOURCE_DIR: 'dist-result'
|
2022-08-30 08:53:27 +00:00
|
|
|
|
2023-06-30 08:46:25 +00:00
|
|
|
- name: Install aws CLI
|
2023-07-19 14:42:47 +00:00
|
|
|
if: ${{ env.IS_S3_RELEASE == 'true' }}
|
2023-06-30 08:46:25 +00:00
|
|
|
uses: unfor19/install-aws-cli-action@master
|
|
|
|
|
|
|
|
- name: Perform cache invalidation
|
2023-07-19 14:42:47 +00:00
|
|
|
if: ${{ env.IS_S3_RELEASE == 'true' }}
|
2023-06-30 08:46:25 +00:00
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
AWS_REGION: 'eu-west-1'
|
|
|
|
run: |
|
2023-06-30 09:24:16 +00:00
|
|
|
echo "Looking for distribution for bucket: ${{ env.BUCKET_NAME }}"
|
|
|
|
id=$(aws cloudfront list-distributions | jq -Mrc '.DistributionList.Items | .[] | select(.DefaultCacheBehavior.TargetOriginId == "${{ env.BUCKET_NAME }}") | .Id')
|
|
|
|
echo "Found id is: ${id}"
|
|
|
|
aws cloudfront create-invalidation --distribution-id $id --paths "/*"
|
2023-06-30 08:46:25 +00:00
|
|
|
|
2023-03-24 15:42:33 +00:00
|
|
|
- name: Add preview label
|
|
|
|
uses: actions-ecosystem/action-add-labels@v1
|
2023-07-12 15:37:49 +00:00
|
|
|
if: ${{ env.IS_PR == 'true' }}
|
2023-03-24 15:42:33 +00:00
|
|
|
with:
|
|
|
|
labels: ${{ matrix.app }}-preview
|
|
|
|
number: ${{ github.event.number }}
|
2023-05-09 16:24:39 +00:00
|
|
|
|
2023-05-11 13:42:35 +00:00
|
|
|
- name: Trigger fleek deployment
|
2023-06-15 16:03:59 +00:00
|
|
|
# release to ipfs happens only on mainnet (represented by main branch) for trading
|
2023-07-12 15:37:49 +00:00
|
|
|
if: ${{ env.IS_IPFS_RELEASE == 'true' }}
|
2023-05-11 13:42:35 +00:00
|
|
|
run: |
|
2023-07-13 14:10:07 +00:00
|
|
|
if [[ "${{ env.IS_MAINNET_RELEASE }}" = "true" ]]; then
|
2023-06-20 14:17:13 +00:00
|
|
|
# display info about app
|
|
|
|
curl --fail -H "Authorization: ${{ secrets.FLEEK_API_KEY }}" \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-d '{"query": "query{getSiteById(siteId:\"f8f2e051-f18e-49e6-b876-0a39369dc0d8\"){id latestDeploy{id status}}}"}' \
|
|
|
|
https://api.fleek.co/graphql
|
|
|
|
|
|
|
|
# trigger new deployment as base image is always set to vegaprotocol/trading:mainnet
|
|
|
|
curl --fail -H "Authorization: ${{ secrets.FLEEK_API_KEY }}" \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-d '{"query": "mutation{triggerDeploy(siteId:\"f8f2e051-f18e-49e6-b876-0a39369dc0d8\"){id status}}"}' \
|
|
|
|
https://api.fleek.co/graphql
|
|
|
|
|
2023-07-13 14:10:07 +00:00
|
|
|
elif [[ "${{ env.IS_TESTNET_RELEASE }}" = "true" ]]; then
|
2023-06-20 14:17:13 +00:00
|
|
|
# display info about app
|
|
|
|
curl --fail -H "Authorization: ${{ secrets.FLEEK_API_KEY }}" \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-d '{"query": "query{getSiteById(siteId:\"79baaeca-1952-4ae7-a256-f668cfc1d68e\"){id latestDeploy{id status}}}"}' \
|
|
|
|
https://api.fleek.co/graphql
|
|
|
|
|
|
|
|
# trigger new deployment as base image is always set to vegaprotocol/trading:mainnet
|
|
|
|
curl --fail -H "Authorization: ${{ secrets.FLEEK_API_KEY }}" \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-d '{"query": "mutation{triggerDeploy(siteId:\"79baaeca-1952-4ae7-a256-f668cfc1d68e\"){id status}}"}' \
|
|
|
|
https://api.fleek.co/graphql
|
2023-06-20 12:49:39 +00:00
|
|
|
fi
|
2023-05-12 13:18:15 +00:00
|
|
|
|
2023-05-24 10:36:11 +00:00
|
|
|
- name: Check out ipfs-redirect
|
2023-07-12 15:37:49 +00:00
|
|
|
if: ${{ env.IS_IPFS_RELEASE == 'true' }}
|
2023-05-24 10:36:11 +00:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
2023-05-24 11:47:36 +00:00
|
|
|
repository: 'vegaprotocol/ipfs-redirect'
|
2023-05-24 10:36:11 +00:00
|
|
|
path: 'ipfs-redirect'
|
|
|
|
fetch-depth: '0'
|
|
|
|
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
|
|
|
|
2023-06-21 11:05:42 +00:00
|
|
|
- name: Update interstitial page to point to the new console
|
2023-07-12 15:37:49 +00:00
|
|
|
if: ${{ env.IS_IPFS_RELEASE == 'true' }}
|
2023-05-24 10:36:11 +00:00
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
2023-05-12 13:18:15 +00:00
|
|
|
run: |
|
2023-06-21 11:05:42 +00:00
|
|
|
# set CID
|
2023-05-12 13:18:15 +00:00
|
|
|
curl -L https://dist.ipfs.tech/kubo/v0.20.0/kubo_v0.20.0_linux-amd64.tar.gz -o kubo.tgz
|
|
|
|
tar -xzf kubo.tgz
|
|
|
|
export PATH="$PATH:$PWD/kubo"
|
|
|
|
which ipfs
|
|
|
|
new_hash=$(cat ${{ matrix.app }}-ipfs-hash)
|
2023-05-17 12:45:06 +00:00
|
|
|
new_cid=$(ipfs cid format -v 1 -b base32 $new_hash)
|
|
|
|
|
2023-05-24 11:37:04 +00:00
|
|
|
(
|
|
|
|
cd ipfs-redirect
|
|
|
|
|
2023-06-21 11:05:42 +00:00
|
|
|
# configure git
|
2023-05-24 11:37:04 +00:00
|
|
|
git status
|
|
|
|
cat .git/config
|
|
|
|
git config --global user.email "vega-ci-bot@vega.xyz"
|
|
|
|
git config --global user.name "vega-ci-bot"
|
|
|
|
|
2023-06-21 11:05:42 +00:00
|
|
|
# update CID files
|
2023-07-12 15:37:49 +00:00
|
|
|
if [[ "${{ env.IS_MAINNET_RELEASE }}" = "true" ]]; then
|
2023-06-21 09:00:27 +00:00
|
|
|
echo $new_hash > cidv0-mainnet.txt
|
|
|
|
echo $new_cid > cidv1-mainnet.txt
|
|
|
|
git add cidv0-mainnet.txt cidv1-mainnet.txt
|
2023-07-12 15:37:49 +00:00
|
|
|
elif [[ "${{ env.IS_TESTNET_RELEASE }}" = "true" ]]; then
|
2023-06-21 09:00:27 +00:00
|
|
|
echo $new_hash > cidv0-fairground.txt
|
|
|
|
echo $new_cid > cidv1-fairground.txt
|
|
|
|
git add cidv0-fairground.txt cidv1-fairground.txt
|
|
|
|
fi
|
|
|
|
|
2023-06-21 11:05:42 +00:00
|
|
|
# create commit
|
2023-05-24 11:37:04 +00:00
|
|
|
commit_msg="Automated hash update from ${{ github.ref }}"
|
|
|
|
git commit -m "$commit_msg"
|
2023-06-21 11:05:42 +00:00
|
|
|
git push -u origin "main"
|
2023-05-24 11:37:04 +00:00
|
|
|
)
|