Skip to content

Commit

Permalink
chore: add docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasbhat0 committed Jul 16, 2024
1 parent f4c48c5 commit ee7a5df
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/copybara-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,30 @@ on:

jobs:
publish-copybara:
if: github.repository == 'Olivr/copybara-action'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
name: Publish to Docker Hub
steps:
- uses: actions/checkout@v2
- name: Checkout Copybara source repository
uses: actions/checkout@v2
with:
repository: google/copybara
path: copybara
fetch-depth: 1

- name: Get Copybara latest commit's SHA
run: echo "COPYBARA_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
run: echo "COPYBARA_SHA=$(git -C copybara rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Extract metadata from GitHub Action context
id: meta
uses: docker/metadata-action@v3
with:
images: |
olivr/copybara
ghcr.io/olivr/copybara
shreyasbhat0/copybara
ghcr.io/shreyasbhat0/copybara
tags: |
type=raw,${{ env.COPYBARA_SHA }}
type=schedule,pattern={{date 'YYYYMMDD'}}
Expand All @@ -45,8 +46,8 @@ jobs:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: olivrbot
password: ${{ secrets.DOCKER_TOKEN_BOT }}
username: yourdockerhubusername
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
Expand All @@ -55,9 +56,8 @@ jobs:
username: ${{ github.actor }}
password: ${{ github.token }}

# Remove when https://github.com/google/copybara/pull/186 is merged
- name: Use working Dockerfile
run: curl -s https://raw.githubusercontent.com/Olivr/copybara-action/main/.github/Dockerfile > Dockerfile
run: curl -s https://raw.githubusercontent.com/google/copybara/main/.github/Dockerfile > Dockerfile

- name: Build and push
uses: docker/build-push-action@v2
Expand All @@ -71,6 +71,7 @@ jobs:
# Experimental
- name: Install Cosign
uses: sigstore/cosign-installer@main

- name: Sign the image with GitHub OIDC **EXPERIMENTAL**
run: cosign sign --oidc-issuer https://token.actions.githubusercontent.com ${TAGS}
env:
Expand Down

0 comments on commit ee7a5df

Please sign in to comment.