Update Docker GH Action

Now it will push the master tag instead of dev for the main branch.
This commit is contained in:
Sergey Stepanov 2023-04-20 21:49:52 +03:00
parent df980c5cf4
commit 31638b0805
No known key found for this signature in database
GPG key ID: A56B4929BAA8556B
4 changed files with 49 additions and 61 deletions

View file

@ -2,7 +2,7 @@ version: "3.9"
x-params:
&default-params
image: ghcr.io/giongto35/cloud-game/cloud-game:${IMAGE_TAG:-dev}
image: ghcr.io/giongto35/cloud-game/cloud-game:${IMAGE_TAG:-master}
network_mode: "host"
privileged: true
restart: always

48
.github/workflows/docker_publish.yml vendored Normal file
View file

@ -0,0 +1,48 @@
# ----------------------------------------------------------------------------------
# Publish Docker image from the current master branch or v* into Github repository
# ----------------------------------------------------------------------------------
name: docker-publish
on:
push:
branches:
- master
tags:
- 'v*'
jobs:
docker-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo "V=$(./scripts/version.sh)" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}/cloud-game
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
build_args: VERSION=${{ env.V }}
context: .
push: true
provenance: false
sbom: false
tags: |
${{ steps.meta.outputs.tags }}
labels: |
${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

View file

@ -1,31 +0,0 @@
# ------------------------------------------------------------------------
# Publish Docker image from the stable snapshot into Github repository
# ------------------------------------------------------------------------
name: publish-stable
on:
push:
tags:
- 'v*'
jobs:
docker-publish-stable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- run: echo "V=$(./scripts/version.sh)" >> $GITHUB_ENV
- uses: docker/build-push-action@v1
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
add_git_labels: true
tags: latest,${{ env.TAG }}
build_args: VERSION=${{ env.V }}
registry: docker.pkg.github.com
repository: ${{ github.REPOSITORY }}/cloud-game

View file

@ -1,29 +0,0 @@
# ----------------------------------------------------------------------------
# Publish Docker image from the current master branch into Github repository
# ----------------------------------------------------------------------------
name: publish-unstable
on:
push:
branches:
- master
jobs:
docker-publish-unstable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo "V=$(./scripts/version.sh)" >> $GITHUB_ENV
- uses: docker/build-push-action@v1
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
add_git_labels: true
tags: dev
build_args: VERSION=${{ env.V }}
registry: docker.pkg.github.com
repository: ${{ github.REPOSITORY }}/cloud-game