Skip to content

Commit

Permalink
Merge pull request #81 from sohosai/chore/#80-add_image_publisher_wor…
Browse files Browse the repository at this point in the history
…kflow

Dockerイメージをレジストリにpushするワークフローの追加
  • Loading branch information
momeemt authored Sep 20, 2023
2 parents 8a08bf7 + 298308d commit 694abb7
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release
on: [push]

jobs:
push-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set tag
id: set_tag
run: |
TAG_NAME="${{ github.ref_name }}"
CLEANED_TAG_NAME=$(echo "$TAG_NAME" | sed 's/[^a-zA-Z0-9_.-]/-/g')
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "::set-output name=tag::latest"
else
echo "::set-output name=tag::$CLEANED_TAG_NAME"
fi
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}:${{ steps.set_tag.outputs.tag }}

0 comments on commit 694abb7

Please sign in to comment.