From 3b46ba16f7e9ef08c83c0f9cab7672f2fdde0650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lasse=20M=C3=B8ldrup?= Date: Tue, 26 Mar 2024 14:40:26 +0100 Subject: [PATCH] Add release actions for examples --- .../release-auction-sponsored-txs-docker.yml | 53 ++++++++++++++++++ .../workflows/release-euroe-demo-docker.yml | 53 ++++++++++++++++++ .github/workflows/release-gallery-docker.yml | 53 ++++++++++++++++++ .../workflows/release-sign-message-docker.yml | 56 +++++++++++++++++++ ...release-simple-age-verification-docker.yml | 53 ++++++++++++++++++ .../release-sponsored-txs-docker.yml | 53 ++++++++++++++++++ gallery/Jenkinsfile | 36 ------------ signMessage/Jenkinsfile | 35 ------------ simpleAgeVerification/Jenkinsfile | 35 ------------ sponsoredTransactions/frontend/Jenkinsfile | 36 ------------ .../frontend/Jenkinsfile | 36 ------------ 11 files changed, 321 insertions(+), 178 deletions(-) create mode 100644 .github/workflows/release-auction-sponsored-txs-docker.yml create mode 100644 .github/workflows/release-euroe-demo-docker.yml create mode 100644 .github/workflows/release-gallery-docker.yml create mode 100644 .github/workflows/release-sign-message-docker.yml create mode 100644 .github/workflows/release-simple-age-verification-docker.yml create mode 100644 .github/workflows/release-sponsored-txs-docker.yml delete mode 100644 gallery/Jenkinsfile delete mode 100644 signMessage/Jenkinsfile delete mode 100644 simpleAgeVerification/Jenkinsfile delete mode 100644 sponsoredTransactions/frontend/Jenkinsfile delete mode 100644 sponsoredTransactionsAuction/frontend/Jenkinsfile diff --git a/.github/workflows/release-auction-sponsored-txs-docker.yml b/.github/workflows/release-auction-sponsored-txs-docker.yml new file mode 100644 index 00000000..18aefb95 --- /dev/null +++ b/.github/workflows/release-auction-sponsored-txs-docker.yml @@ -0,0 +1,53 @@ +# This job builds and publishes a docker image for the sponsored transactions auction dApp to +# the dockerhub image repository. +name: Create and publish a Docker image for the sponsored transactions auction dApp. + +on: + workflow_dispatch: # allows manual trigger + + push: + tags: + - 'cis2-sponsored-transactions/*.*.*' + +env: + REGISTRY: docker.io + IMAGE_NAME: concordium/dapp-auction-sponsored-txs + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + environment: testnet-deployments + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + # Uses the `docker/login-action` action to log in to the Container registry. + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract tag from package.json + id: meta + run: | + export VERSION=$(jq -r .version sponsoredTransactionAuction/frontend/package.json) + export FULL_IMAGE_TAG="${{ env.REGISTRY }}/concordium/$IMAGE_NAME:$VERSION" + echo "::notice FULL_IMAGE_TAG=${FULL_IMAGE_TAG}" + # Make sure the image does not exist. Abort if we can retrieve any metadata. + if docker manifest inspect ${FULL_IMAGE_TAG} > /dev/null; then + echo "::error ${FULL_IMAGE_TAG} already exists" + exit 1 + else + # Store the full image tag into a tag variable for the following step. + echo "tag=${FULL_IMAGE_TAG}" > "$GITHUB_OUTPUT" + fi + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + file: ./sponsoredTransactionsAuction/Dockerfile + push: true + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tag }} \ No newline at end of file diff --git a/.github/workflows/release-euroe-demo-docker.yml b/.github/workflows/release-euroe-demo-docker.yml new file mode 100644 index 00000000..0a12db82 --- /dev/null +++ b/.github/workflows/release-euroe-demo-docker.yml @@ -0,0 +1,53 @@ +# This job builds and publishes a docker image for the euroe demo dApp to +# the dockerhub image repository. +name: Create and publish a Docker image for the euroe demo dApp. + +on: + workflow_dispatch: # allows manual trigger + + push: + tags: + - 'euroe-demo/*.*.*' + +env: + REGISTRY: docker.io + IMAGE_NAME: concordium/dapp-euroe-demo + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + environment: testnet-deployments + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + # Uses the `docker/login-action` action to log in to the Container registry. + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract tag from package.json + id: meta + run: | + export VERSION=$(jq -r .version euroe-demo/package.json) + export FULL_IMAGE_TAG="${{ env.REGISTRY }}/concordium/$IMAGE_NAME:$VERSION" + echo "::notice FULL_IMAGE_TAG=${FULL_IMAGE_TAG}" + # Make sure the image does not exist. Abort if we can retrieve any metadata. + if docker manifest inspect ${FULL_IMAGE_TAG} > /dev/null; then + echo "::error ${FULL_IMAGE_TAG} already exists" + exit 1 + else + # Store the full image tag into a tag variable for the following step. + echo "tag=${FULL_IMAGE_TAG}" > "$GITHUB_OUTPUT" + fi + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: ./euroe-demo + file: ./euroe-demo/scripts/Dockerfile + push: true + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tag }} \ No newline at end of file diff --git a/.github/workflows/release-gallery-docker.yml b/.github/workflows/release-gallery-docker.yml new file mode 100644 index 00000000..56eb6516 --- /dev/null +++ b/.github/workflows/release-gallery-docker.yml @@ -0,0 +1,53 @@ +# This job builds and publishes a docker image for the gallery dApp to +# the dockerhub image repository. +name: Create and publish a Docker image for the gallery dApp. + +on: + workflow_dispatch: # allows manual trigger + + push: + tags: + - 'gallery/*.*.*' + +env: + REGISTRY: docker.io + IMAGE_NAME: concordium/dapp-gallery + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + environment: testnet-deployments + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + # Uses the `docker/login-action` action to log in to the Container registry. + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract tag from package.json + id: meta + run: | + export VERSION=$(jq -r .version gallery/package.json) + export FULL_IMAGE_TAG="${{ env.REGISTRY }}/concordium/$IMAGE_NAME:$VERSION" + echo "::notice FULL_IMAGE_TAG=${FULL_IMAGE_TAG}" + # Make sure the image does not exist. Abort if we can retrieve any metadata. + if docker manifest inspect ${FULL_IMAGE_TAG} > /dev/null; then + echo "::error ${FULL_IMAGE_TAG} already exists" + exit 1 + else + # Store the full image tag into a tag variable for the following step. + echo "tag=${FULL_IMAGE_TAG}" > "$GITHUB_OUTPUT" + fi + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + file: gallery/Dockerfile + push: true + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tag }} \ No newline at end of file diff --git a/.github/workflows/release-sign-message-docker.yml b/.github/workflows/release-sign-message-docker.yml new file mode 100644 index 00000000..76aad3ba --- /dev/null +++ b/.github/workflows/release-sign-message-docker.yml @@ -0,0 +1,56 @@ +# This job builds and publishes a docker image for the sign message dApp to +# the dockerhub image repository. +name: Create and publish a Docker image for the sign message dApp. + +on: + workflow_dispatch: # allows manual trigger + + push: + tags: + - 'signmessage/*.*.*' + + pull_request: + branches: main + +env: + REGISTRY: docker.io + IMAGE_NAME: concordium/dapp-signmessage + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + environment: testnet-deployments + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + # Uses the `docker/login-action` action to log in to the Container registry. + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract tag from package.json + id: meta + run: | + export VERSION=$(jq -r .version signMessage/package.json) + export FULL_IMAGE_TAG="${{ env.REGISTRY }}/concordium/$IMAGE_NAME:$VERSION" + echo "::notice FULL_IMAGE_TAG=${FULL_IMAGE_TAG}" + # Make sure the image does not exist. Abort if we can retrieve any metadata. + if docker manifest inspect ${FULL_IMAGE_TAG} > /dev/null; then + echo "::error ${FULL_IMAGE_TAG} already exists" + exit 1 + else + # Store the full image tag into a tag variable for the following step. + echo "tag=${FULL_IMAGE_TAG}" > "$GITHUB_OUTPUT" + fi + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: ./signMessage + file: ./signMessage/Dockerfile + push: true + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tag }} \ No newline at end of file diff --git a/.github/workflows/release-simple-age-verification-docker.yml b/.github/workflows/release-simple-age-verification-docker.yml new file mode 100644 index 00000000..70cc6925 --- /dev/null +++ b/.github/workflows/release-simple-age-verification-docker.yml @@ -0,0 +1,53 @@ +# This job builds and publishes a docker image for the simple age verification dApp to +# the dockerhub image repository. +name: Create and publish a Docker image for the simple age verification dApp. + +on: + workflow_dispatch: # allows manual trigger + + push: + tags: + - 'simple-age-verification/*.*.*' + +env: + REGISTRY: docker.io + IMAGE_NAME: concordium/dapp-simple-age-verification + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + environment: testnet-deployments + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + # Uses the `docker/login-action` action to log in to the Container registry. + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract tag from package.json + id: meta + run: | + export VERSION=$(jq -r .version simpleAgeVerification/package.json) + export FULL_IMAGE_TAG="${{ env.REGISTRY }}/concordium/$IMAGE_NAME:$VERSION" + echo "::notice FULL_IMAGE_TAG=${FULL_IMAGE_TAG}" + # Make sure the image does not exist. Abort if we can retrieve any metadata. + if docker manifest inspect ${FULL_IMAGE_TAG} > /dev/null; then + echo "::error ${FULL_IMAGE_TAG} already exists" + exit 1 + else + # Store the full image tag into a tag variable for the following step. + echo "tag=${FULL_IMAGE_TAG}" > "$GITHUB_OUTPUT" + fi + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: ./simpleAgeVerification + file: ./simpleAgeVerification/Dockerfile + push: true + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tag }} \ No newline at end of file diff --git a/.github/workflows/release-sponsored-txs-docker.yml b/.github/workflows/release-sponsored-txs-docker.yml new file mode 100644 index 00000000..b3a3ccbf --- /dev/null +++ b/.github/workflows/release-sponsored-txs-docker.yml @@ -0,0 +1,53 @@ +# This job builds and publishes a docker image for the sponsored transactions dApp to +# the dockerhub image repository. +name: Create and publish a Docker image for the sponsored transactions dApp. + +on: + workflow_dispatch: # allows manual trigger + + push: + tags: + - 'sponsored-transactions/*.*.*' + +env: + REGISTRY: docker.io + IMAGE_NAME: concordium/dapp-sponsored-txs + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + environment: testnet-deployments + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + # Uses the `docker/login-action` action to log in to the Container registry. + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract tag from package.json + id: meta + run: | + export VERSION=$(jq -r .version sponsoredTransactions/frontend/package.json) + export FULL_IMAGE_TAG="${{ env.REGISTRY }}/concordium/$IMAGE_NAME:$VERSION" + echo "::notice FULL_IMAGE_TAG=${FULL_IMAGE_TAG}" + # Make sure the image does not exist. Abort if we can retrieve any metadata. + if docker manifest inspect ${FULL_IMAGE_TAG} > /dev/null; then + echo "::error ${FULL_IMAGE_TAG} already exists" + exit 1 + else + # Store the full image tag into a tag variable for the following step. + echo "tag=${FULL_IMAGE_TAG}" > "$GITHUB_OUTPUT" + fi + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + file: ./sponsoredTransactions/Dockerfile + push: true + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tag }} \ No newline at end of file diff --git a/gallery/Jenkinsfile b/gallery/Jenkinsfile deleted file mode 100644 index 3d06b726..00000000 --- a/gallery/Jenkinsfile +++ /dev/null @@ -1,36 +0,0 @@ -// Expected parameters: -// - image_tag: Tag that will be used for the new image. -// - build_image: Base image that the image being built extends. -pipeline { - agent any - environment { - image_repo = "concordium/dapp-gallery" - image_name = "${image_repo}:${image_tag}" - } - stages { - stage('dockerhub-login') { - environment { - // Defines 'CRED_USR' and 'CRED_PSW' - // (see 'https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#handling-credentials'). - CRED = credentials('jenkins-dockerhub') - } - steps { - sh 'docker login --username "${CRED_USR}" --password "${CRED_PSW}"' - } - } - stage('build-push') { - steps { - sh '''\ - docker build \ - --build-arg build_image="${build_image}" \ - --label build_image="${build_image}" \ - --tag="${image_name}" \ - -f ./gallery/Dockerfile \ - . - docker push "${image_name}" - '''.stripIndent() - } - } - } -} - diff --git a/signMessage/Jenkinsfile b/signMessage/Jenkinsfile deleted file mode 100644 index 63877014..00000000 --- a/signMessage/Jenkinsfile +++ /dev/null @@ -1,35 +0,0 @@ -// Expected parameters: -// - image_tag: Tag that will be used for the new image. -// - build_image: Base image that the image being built extends. -pipeline { - agent any - environment { - image_repo = "concordium/dapp-signmessage" - image_name = "${image_repo}:${image_tag}" - } - stages { - stage('dockerhub-login') { - environment { - // Defines 'CRED_USR' and 'CRED_PSW' - // (see 'https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#handling-credentials'). - CRED = credentials('jenkins-dockerhub') - } - steps { - sh 'docker login --username "${CRED_USR}" --password "${CRED_PSW}"' - } - } - stage('build-push') { - steps { - sh '''\ - docker build \ - --build-arg build_image="${build_image}" \ - --label build_image="${build_image}" \ - --tag="${image_name}" \ - --pull \ - ./signMessage - docker push "${image_name}" - '''.stripIndent() - } - } - } -} diff --git a/simpleAgeVerification/Jenkinsfile b/simpleAgeVerification/Jenkinsfile deleted file mode 100644 index 48dde2eb..00000000 --- a/simpleAgeVerification/Jenkinsfile +++ /dev/null @@ -1,35 +0,0 @@ -// Expected parameters: -// - image_tag: Tag that will be used for the new image. -// - build_image: Base image that the image being built extends. -pipeline { - agent any - environment { - image_repo = "concordium/dapp-simple-age-verification" - image_name = "${image_repo}:${image_tag}" - } - stages { - stage('dockerhub-login') { - environment { - // Defines 'CRED_USR' and 'CRED_PSW' - // (see 'https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#handling-credentials'). - CRED = credentials('jenkins-dockerhub') - } - steps { - sh 'docker login --username "${CRED_USR}" --password "${CRED_PSW}"' - } - } - stage('build-push') { - steps { - sh '''\ - docker build \ - --build-arg build_image="${build_image}" \ - --label build_image="${build_image}" \ - --tag="${image_name}" \ - -f ./simpleAgeVerification/Dockerfile \ - ./simpleAgeVerification - docker push "${image_name}" - '''.stripIndent() - } - } - } -} diff --git a/sponsoredTransactions/frontend/Jenkinsfile b/sponsoredTransactions/frontend/Jenkinsfile deleted file mode 100644 index 852f8154..00000000 --- a/sponsoredTransactions/frontend/Jenkinsfile +++ /dev/null @@ -1,36 +0,0 @@ -// Expected parameters: -// - image_tag: Tag that will be used for the new image. -// - build_image: Base image that the image being built extends. -pipeline { - agent any - environment { - image_repo = "concordium/dapp-sponsored-txs" - image_name = "${image_repo}:${image_tag}" - } - stages { - stage('dockerhub-login') { - environment { - // Defines 'CRED_USR' and 'CRED_PSW' - // (see 'https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#handling-credentials'). - CRED = credentials('jenkins-dockerhub') - } - steps { - sh 'docker login --username "${CRED_USR}" --password "${CRED_PSW}"' - } - } - stage('build-push') { - steps { - sh '''\ - docker build \ - --build-arg build_image="${build_image}" \ - --label build_image="${build_image}" \ - --tag="${image_name}" \ - --pull \ - --file sponsoredTransactions/Dockerfile \ - . - docker push "${image_name}" - '''.stripIndent() - } - } - } -} diff --git a/sponsoredTransactionsAuction/frontend/Jenkinsfile b/sponsoredTransactionsAuction/frontend/Jenkinsfile deleted file mode 100644 index 6d9b622d..00000000 --- a/sponsoredTransactionsAuction/frontend/Jenkinsfile +++ /dev/null @@ -1,36 +0,0 @@ -// Expected parameters: -// - image_tag: Tag that will be used for the new image. -// - build_image: Base image that the image being built extends. -pipeline { - agent any - environment { - image_repo = "concordium/dapp-auction-sponsored-txs" - image_name = "${image_repo}:${image_tag}" - } - stages { - stage('dockerhub-login') { - environment { - // Defines 'CRED_USR' and 'CRED_PSW' - // (see 'https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#handling-credentials'). - CRED = credentials('jenkins-dockerhub') - } - steps { - sh 'docker login --username "${CRED_USR}" --password "${CRED_PSW}"' - } - } - stage('build-push') { - steps { - sh '''\ - docker build \ - --build-arg build_image="${build_image}" \ - --label build_image="${build_image}" \ - --tag="${image_name}" \ - --pull \ - --file sponsoredTransactionsAuction/Dockerfile \ - . - docker push "${image_name}" - '''.stripIndent() - } - } - } -}