script (#13) #35
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: 1.20.1-publish | |
on: | |
push: | |
branches: [ "main" ] | |
# Publish semver tags as releases. | |
tags: [ 'v*.*.*' ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 | |
- name: Log into dockerHUB | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_SK }} | |
- name: Generate Docker metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
WHF-Studio/mohist-docker | |
tags: | | |
value=mohist-docker:1.20.1,value=mohist-docker:latest-1.20.1 | |
labels: | | |
org.opencontainers.image.title=mohist-docker | |
org.opencontainers.image.description=A Docker image for running the Mohist server | |
org.opencontainers.image.url=https://hub.docker.com/r/WHF-Studio/mohist-docker | |
org.opencontainers.image.source=https://github.com/WHF-Studio/mohist-docker | |
org.opencontainers.image.author=敖律风 | |
- name: Build dependencies Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
tags: mohist-docker:build-1.20.1 | |
target: build-1.20.1 | |
no-cache: true | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
target: run-1.20.1 | |
no-cache: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |