Skip to content

Commit 9d7fddd

Browse files
authored
レジストリの移行 (#25)
* ci: Migrate docker registory to container registry * fix: Use build-push-action
1 parent 4922dfc commit 9d7fddd

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

.github/workflows/docker-package.yaml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,22 @@ jobs:
1414

1515
steps:
1616
- uses: actions/checkout@v2
17-
18-
- name: Build an image with a tag
19-
run: docker build -t app -f docker/bot.Dockerfile .
17+
- uses: docker/setup-buildx-action@v1
2018

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

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

0 commit comments

Comments
 (0)