-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Docker Image | ||
|
||
on: | ||
push: | ||
branches: [ 'devnet_*', 'testnet_*' ] | ||
pull_request: | ||
branches: | ||
- "**" | ||
paths: | ||
- '.github/workflows/docker_image.yml' | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest-16-cores | ||
timeout-minutes: 60 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- id: auth | ||
name: Auth service account | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
credentials_json: ${{ secrets.GCP_SA_ACTIONS_RUNNER_KEY }} | ||
- name: Set up Google Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v1 | ||
|
||
- name: Authenticate Docker with GCP | ||
run: | | ||
gcloud auth configure-docker us-docker.pkg.dev | ||
- name: Set GIT_COMMIT and BRANCH_NAME variables | ||
id: git-info | ||
run: | | ||
echo "GIT_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV | ||
if [ -n "${{ github.head_ref }}" ]; then | ||
echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV | ||
else | ||
echo "BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV | ||
fi | ||
- name: Build Docker image | ||
run: | | ||
docker build --build-arg git_commit=${{ env.GIT_COMMIT }} \ | ||
-f docker/Dockerfile . \ | ||
-t us-docker.pkg.dev/linera-io-dev/linera-public-registry/linera-test:${{ env.BRANCH_NAME }}-${{ env.GIT_COMMIT }} \ | ||
-t ${{ env.BRANCH_NAME }} \ | ||
-t ${{ env.GIT_COMMIT }} | ||
- name: Push Docker image to Google Artifact Registry | ||
run: | | ||
docker push -a us-docker.pkg.dev/linera-io-dev/linera-public-registry/linera-test:${{ env.BRANCH_NAME }}-${{ env.GIT_COMMIT }} |