Create and publish a Docker image for verifiable-sc. #5
Workflow file for this run
This file contains hidden or 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: Create and publish a Docker image for verifiable-sc. | |
| on: | |
| workflow_dispatch: # allows manual trigger | |
| push: | |
| tags: | |
| - 'verifiable-sc/*.*.*' | |
| env: | |
| REGISTRY: docker.io | |
| SERVICE_NAME: 'verifiable-sc' | |
| SOURCE_IMAGE_TAG: 'rust:1.85.0' | |
| jobs: | |
| build-and-push-image: | |
| runs-on: ubuntu-latest | |
| environment: testnet-deployments | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - run: | | |
| rustup update stable | |
| rustup default stable | |
| rustup target add wasm32-unknown-unknown | |
| # - uses: cachix/install-nix-action@v31 | |
| - name: Test smart contract | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| working-directory: ./concordium-base/smart-contracts/rust-contracts/example-contracts/fib | |
| run: | | |
| docker build -f "$GITHUB_WORKSPACE/reproducible/build.Dockerfile" --build-arg source_image="$SOURCE_IMAGE_TAG" -t local-image "$GITHUB_WORKSPACE/reproducible" | |
| cargo run --manifest-path "$GITHUB_WORKSPACE/cargo-concordium/Cargo.toml" | |
| # cargo run --manifest-path "$GITHUB_WORKSPACE/cargo-concordium/Cargo.toml" -- concordium build --verifiable "localhost/local-image:latest" | |
| # cargo run --manifest-path "$GITHUB_WORKSPACE/cargo-concordium/Cargo.toml" -- concordium verify-build --module ./concordium-out/module.wasm.v1 --source ./concordium-out/module.wasm.v1.tar | |
| - name: Extract version from git tag | |
| id: meta | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| # Extract version by splitting on "/" and taking the second part | |
| TAG_VERSION=$(echo "$TAG" | cut -d '/' -f2) | |
| IMG_VERSION=$(echo "$SOURCE_IMAGE_TAG" | cut -d ':' -f2) | |
| if [ $TAG_VERSION != $IMG_VERSION ]; then | |
| echo "Tag version does not match the source image version." | |
| exit 1 | |
| fi | |
| # Save tag as fx "docker.io/concordium/verifiable-sc-1.85.0" | |
| echo "tag=$REGISTRY/concordium/$SERVICE_NAME-$TAG_VERSION" >> $GITHUB_OUTPUT | |
| # 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: Build and push Docker image | |
| # uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
| # with: | |
| # context: . | |
| # file: ./reproducible/build.Dockerfile | |
| # push: true | |
| # platforms: linux/amd64 | |
| # tags: ${{ steps.meta.outputs.tag }} | |
| # build-args: | | |
| # source_image=${{ env.SOURCE_IMAGE_TAG }} |