up 2023-10-28 #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🌥 Docker Push | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
user/app:latest | ||
user/app:1.0.0 | ||
ghcr.io/user/app:latest | ||
ghcr.io/user/app:1.0.0 | ||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v3 | ||
- name: Get Github tag | ||
id: meta | ||
run: | | ||
echo "::set-output name=tag::$(curl --silent "https://api.github.com/repos/hktalent/scan4all/releases/latest" | jq -r .tag_name)" | ||
- name: Setup QEMU Emulator | ||
uses: docker/setup-qemu-action@master | ||
with: | ||
platforms: all | ||
- name: Setup Docker Buildx Command | ||
id: buildx | ||
uses: docker/setup-buildx-action@master | ||
- name: Login to Dockerhub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
- name: Build Docker Image and Push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
push: true | ||
tags: hktalent/scan4all:latest,hktalent/scan4all:${{ steps.meta.outputs.tag }} | ||
- name: Update Docker Hub Description | ||
uses: peter-evans/dockerhub-description@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
repository: cloudreve/cloudreve | ||
short-description: ${{ github.event.repository.description }} | ||
- name: Image Digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |