Skip to content

Commit

Permalink
docker tag
Browse files Browse the repository at this point in the history
  • Loading branch information
vnghia committed Aug 10, 2024
1 parent 370fc23 commit aa731ef
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ name: Main
on:
push:
branches: ["main"]
tags:
- "*-?v[0-9]+*"
pull_request:
branches: ["main"]
workflow_dispatch:

env:
GHCR_REGISTRY: ghcr.io
Expand Down Expand Up @@ -64,8 +65,8 @@ jobs:
run: |
echo "version=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
echo "docker-arch=${{ startsWith(matrix.platform.target, 'x86_64') && 'amd64' || 'arm64' }}" >> "$GITHUB_OUTPUT"
echo "profile=${{ (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && 'release' || 'dev' }}" >> "$GITHUB_OUTPUT"
echo "output-dir=${{ (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && 'release' || 'debug' }}" >> "$GITHUB_OUTPUT"
echo "profile=${{ github.event.ref_type == 'tag' && 'release' || 'dev' }}" >> "$GITHUB_OUTPUT"
echo "output-dir=${{ github.event.ref_type == 'tag' && 'release' || 'debug' }}" >> "$GITHUB_OUTPUT"
- name: Extract rust toolchain
id: toolchain
run: |
Expand Down Expand Up @@ -129,11 +130,24 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
name=ghcr.io/${{ github.repository }}
tags: |
type=ref,event=pr,enable={{!is_default_branch}}
type=semver,pattern=v{{version}},enable={{is_default_branch}}
type=semver,pattern=v{{major}}.{{minor}},enable={{is_default_branch}}
type=semver,pattern=v{{major}},enable={{is_default_branch}}
type=raw,value=develop,enable={{is_default_branch}}
- name: Build and push to ghcr
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.new
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/vnghia/ryot:test
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit aa731ef

Please sign in to comment.