Trigger auto deployment #3
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
name: Trigger auto deployment | |
on: | |
# 手動実行用トリガー | |
workflow_dispatch: | |
env: | |
CONTAINER_REGISTRY: cicd2024rymvmpzpk74hg.azurecr.io | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout to the branch | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set repository name to env | |
run: | | |
echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}" >> $GITHUB_ENV | |
- name: Confirm if env have REPOSITORY_NAME | |
run: | | |
echo ${{ env.REPOSITORY_NAME }} | |
# Add a step | |
- name: Log in to container registry | |
# 認証処理を行うためのアクション | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.CONTAINER_REGISTRY }} | |
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }} | |
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} | |
# Add a step | |
- name: Build and push container image to registry | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: ${{ env.CONTAINER_REGISTRY }}/${{ env.REPOSITORY_NAME }}:${{ github.sha }} | |
file: ./Dockerfile | |
context: ./ |