workflow: push docker image to ghcr.io

This commit is contained in:
Shuanglei Tao
2024-11-26 23:18:44 +08:00
parent b1eaaee2ca
commit 4dad1315d8

View File

@@ -8,6 +8,9 @@ on:
jobs:
build:
runs-on: ubuntu-22.04
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Install packages
@@ -28,6 +31,11 @@ jobs:
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine docker tags
id: docker_tag
run: |
@@ -42,18 +50,22 @@ jobs:
echo "ALPINE_TAG=tsl0922/ttyd:alpine" >> $GITHUB_ENV
esac
- name: build/push docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/s390x
push: true
tags: ${{ env.DOCKER_TAG }}
tags: |
${{ env.DOCKER_TAG }}
ghcr.io/${{ env.DOCKER_TAG }}
- name: build/push docker image (alpine)
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.alpine
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/s390x
push: true
tags: ${{ env.ALPINE_TAG }}
tags: |
${{ env.ALPINE_TAG }}
ghcr.io/${{ env.ALPINE_TAG }}