Skip to content

Commit

Permalink
wip: fix docker publish github action
Browse files Browse the repository at this point in the history
  • Loading branch information
pkarpovich committed Aug 20, 2022
1 parent 06570e4 commit c73565b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/slimy-eggs-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'playlist-synchronizer': patch
---

Fix docker publish script
6 changes: 6 additions & 0 deletions .github/events/release.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"action": "published",
"release": {
"tag_name": "v0.0.1"
}
}
21 changes: 10 additions & 11 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish

on:
release:
types: [created, released, published, prereleased]
types: [published]

jobs:
publish:
Expand All @@ -17,25 +17,24 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build and deploy image to ghcr.io
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
run: |
version="$(echo ${VERSION})"
image_name="$(echo ${REGISTRY}/${IMAGE_NAME})"
echo ${GITHUB_PACKAGE_TOKEN} | docker login ghcr.io -u ${USERNAME} --password-stdin
echo "IMAGE_NAME=${image_name}, VERSION=${version}"
echo "IMAGE_NAME=${image_name}, VERSION=${TAG_NAME}"
docker buildx build --push \
--platform linux/amd64,linux/arm/v7,linux/arm64 \
-t ${image_name}:${version} -t ${image_name}:latest .
-t ${image_name}:${TAG_NAME} -t ${image_name}:latest .

0 comments on commit c73565b

Please sign in to comment.