run autocommit after build and push #1096
Workflow file for this run
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: "Build and Push" | |
env: | |
CACHE_NAME: marlowe-temp | |
ALLOWED_URIS: "https://github.com https://api.github.com" | |
TRUSTED_PUBLIC_KEYS: "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= marlowe-temp.cachix.org-1:1gPjVFpu4QjaAT3tRurCioX+BC23V7mjvFwpP5bV0Ec= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=" | |
SUBSTITUTERS: "https://cache.nixos.org/ https://cache.iog.io https://marlowe-temp.cachix.org https://cache.zw3rk.com/" | |
VAULT_ADDR: "https://vault.dapps.aws.iohkdev.io" | |
NOMAD_ADDR: "https://nomad.dapps.aws.iohkdev.io" | |
NOMAD_NAMESPACE: "marlowe" | |
on: | |
push: | |
branches: | |
- main | |
- PLT-6842-autodeploy | |
tags: | |
- runtime@v* | |
- marlowe-runtime-web@v* | |
- marlowe-apps@v* | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v21 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
install_url: https://releases.nixos.org/nix/nix-2.10.3/install | |
extra_nix_config: | | |
allowed-uris = ${{ env.ALLOWED_URIS }} | |
trusted-public-keys = ${{ env.TRUSTED_PUBLIC_KEYS }} | |
substituters = ${{ env.SUBSTITUTERS }} | |
experimental-features = nix-command flakes | |
- name: Build images and copy to local Docker registry | |
run: | | |
nix build .#oci-images.x86_64-linux.all.copyToDockerDaemon | |
./result/bin/copy-to-docker-daemon | |
- name: Authenticate with container registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Tag and push images | |
run: | | |
tagAndPush() { | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$1 | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
echo IMAGE_ID=$IMAGE_ID | |
docker tag $1:latest $IMAGE_ID:$TAG | |
docker push $IMAGE_ID:$TAG | |
} | |
if [[ "${{ github.ref }}" == "refs/tags/runtime@v"* ]] | |
then | |
# Strip "runtime@v" prefix from tag name | |
export TAG=$(echo "${{ github.ref_name }}" | sed -e "s/^runtime@v//") | |
echo TAG=$TAG | |
tagAndPush "marlowe-chain-indexer" | |
tagAndPush "marlowe-chain-sync" | |
tagAndPush "marlowe-indexer" | |
tagAndPush "marlowe-sync" | |
tagAndPush "marlowe-contract" | |
tagAndPush "marlowe-tx" | |
tagAndPush "marlowe-proxy" | |
tagAndPush "marlowe-web-server" | |
elif [[ "${{ github.ref }}" == "refs/tags/marlowe-apps@v"* ]] | |
then | |
# Strip "marlowe-apps@v" prefix from tag name | |
export TAG=$(echo "${{ github.ref_name }}" | sed -e "s/^marlowe-apps@v//") | |
echo TAG=$TAG | |
tagAndPush "marlowe-pipe" | |
tagAndPush "marlowe-scaling" | |
tagAndPush "marlowe-oracle" | |
tagAndPush "marlowe-finder" | |
elif [[ "${{ github.ref }}" == "refs/tags/marlowe-runtime-web@v"* ]] | |
then | |
# Strip "marlowe-runtime-web@v" prefix from tag name | |
export TAG=$(echo "${{ github.ref_name }}" | sed -e "s/^marlowe-runtime-web@v//") | |
echo TAG=$TAG | |
tagAndPush "marlowe-web-server" | |
else | |
export "TAG=${GITHUB_SHA::8}" | |
echo TAG=$TAG | |
tagAndPush "marlowe-chain-indexer" | |
tagAndPush "marlowe-chain-sync" | |
tagAndPush "marlowe-indexer" | |
tagAndPush "marlowe-sync" | |
tagAndPush "marlowe-contract" | |
tagAndPush "marlowe-tx" | |
tagAndPush "marlowe-proxy" | |
tagAndPush "marlowe-web-server" | |
tagAndPush "marlowe-pipe" | |
tagAndPush "marlowe-scaling" | |
tagAndPush "marlowe-oracle" | |
tagAndPush "marlowe-finder" | |
fi |