Skip to content

Commit

Permalink
レジストリの移行 (#25)
Browse files Browse the repository at this point in the history
* ci: Migrate docker registory to container registry

* fix: Use build-push-action
  • Loading branch information
MikuroXina committed Jul 20, 2021
1 parent 4922dfc commit 9d7fddd
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/docker-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: Build an image with a tag
run: docker build -t app -f docker/bot.Dockerfile .
- uses: docker/setup-buildx-action@v1

- name: Log into the registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push the image
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "master" ] && VERSION=latest
docker tag app $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: docker/bot.Dockerfile
tags: |
ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:latest
ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:${{ github.event.release.tag_name }}
push: true

0 comments on commit 9d7fddd

Please sign in to comment.