Skip to content

Add CODEOWNERS

Add CODEOWNERS #23

name: Build and Push
# Builds and pushes the branch to ECR from master, or the manually selected branch when invoked manually. We stopped using Docker Hub for storing the image of oplogtoredis, where we used a Webhook to do the same thing.
on:
push:
branches:
- master
# Left this here in-case the workflow needs to be developed further rapidly:
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
permissions:
id-token: write
contents: read
jobs:
build-and-push:
name: Build and Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
with:
nix_path: nixpkgs=channel:nixos-unstable
# Examples of the generated tags:
# - v3.0.0 (branch: master)
# - v3.0.0-branch-name (branch: branch-name)
- name: Generate Tag
id: generate-tag
run: |
# Extract the current version from `default.nix`. This must pass.
version=$(nix flake show . --quiet --all-systems --json | jq -r '.defaultPackage."aarch64-darwin".name' | cut -d'-' -f2-)
# Adds the branch name if the workflow is manually invoked from a branch.
tag_branch_segment=""
branch_name=${{ github.event.pull_request && github.head_ref || github.ref_name }}
if [ "$branch_name" != "master" ]; then
tag_branch_segment="-${branch_name}" # adds a -<branch-name> as needed
fi
tag="v${version}${tag_branch_segment}"
echo "TAG=${tag}" >> $GITHUB_OUTPUT
- name: Setup ECR/buildx
uses: ./.github/actions/setup-ecr-buildx
id: setup-ecr-buildx
with:
iam-role-to-assume: ${{ secrets.AWS_PUBLIC_ECR_IAM_ROLE_ARN }}
registry-type: public
- name: Build and push image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # 4.0.0
with:
tags: ${{ steps.setup-ecr-buildx.outputs.ecr_registry }}/tulip/oplogtoredis:${{ steps.generate-tag.outputs.TAG }}
provenance: true
push: true