Docker push for latest #62354
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 for latest | |
on: | |
push: | |
branches: | |
- master | |
release: | |
types: [published] | |
schedule: | |
- cron: '*/30 * * * *' | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: git fetch --unshallow | |
- name: Get latest tag | |
id: latest_tag | |
run: ruby -e 'puts("latest_tag=v#{`git tag`.each_line.map{|l| begin Gem::Version::new(l.sub(/^v/, "")); rescue; nil end}.compact.max.to_s}")' >> $GITHUB_OUTPUT | |
- name: Checkout latest tag | |
run: | | |
set -eu | |
echo "Latest tag: ${{ steps.latest_tag.outputs.latest_tag }}" | |
git reset --hard ${{ steps.latest_tag.outputs.latest_tag }} | |
git status | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: nwtgck | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 | |
push: true | |
tags: nwtgck/piping-server:latest,nwtgck/piping-server:${{ steps.latest_tag.outputs.latest_tag }} |