feat: github workflow create image for ghcr.io

This commit is contained in:
Jack Wills
2023-03-29 17:30:14 +00:00
parent e0b49be840
commit cb1271cf7f
+21 -4
View File
@@ -5,6 +5,7 @@ on:
- 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+'
jobs: jobs:
deploy: deploy:
# Change this to latest - or ubuntu 20.04?
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- name: Checkout - name: Checkout
@@ -64,23 +65,39 @@ jobs:
- name: compress windows_x86_64 binary - name: compress windows_x86_64 binary
run: zip -j ./oxker_windows_x86_64.zip target/x86_64-pc-windows-gnu/release/oxker.exe run: zip -j ./oxker_windows_x86_64.zip target/x86_64-pc-windows-gnu/release/oxker.exe
############################### #########################################
## Build images for Dockerhub # ## Build images for Dockerhub & ghcr.io #
############################### #########################################
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Write release version to env
run: |
CURRENT_SEMVER=${GITHUB_REF_NAME#v}
echo "CURRENT_SEMVER=$CURRENT_SEMVER" >> $GITHUB_ENV
- uses: docker/setup-buildx-action@v2 - uses: docker/setup-buildx-action@v2
id: buildx id: buildx
with: with:
install: true install: true
- name: Build for Docker Hub - name: Build for Dockerhub & ghcr.io
run: | run: |
docker build --platform linux/arm/v6,linux/arm64,linux/amd64 \ docker build --platform linux/arm/v6,linux/arm64,linux/amd64 \
-t ${{ secrets.DOCKERHUB_USERNAME }}/oxker:latest \ -t ${{ secrets.DOCKERHUB_USERNAME }}/oxker:latest \
-t ${{ secrets.DOCKERHUB_USERNAME }}/oxker:${{env.CURRENT_SEMVER}} \
-t ghcr.io/${{ github.repository_owner }}/oxker:latest \
-t ghcr.io/${{ github.repository_owner }}/oxker:${{env.CURRENT_SEMVER}} \
--push \ --push \
-f containerised/Dockerfile . -f containerised/Dockerfile .