forked from crate-ci/typos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gha): add docker push github action
fixes crate-ci#427
- Loading branch information
1 parent
6802cc6
commit 0801bce
Showing
1 changed file
with
44 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,44 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
release_tag: | ||
description: "Release tag to build and push" | ||
required: true | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Determine the release tag | ||
id: get_tag | ||
run: | | ||
if [ "${{ github.event_name }}" == "release" ]; then | ||
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | ||
else | ||
echo "tag=${{ github.event.inputs.release_tag }}" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.get_tag.outputs.tag }} |