Skip to content

Commit

Permalink
ci: fix releasing semver images
Browse files Browse the repository at this point in the history
Release-As: 0.2.2
  • Loading branch information
taobojlen committed Mar 11, 2023
1 parent 5e7e383 commit 43d0509
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 40 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on:
push:
branches:
- main
tags:
- v*

name: deploy

permissions:
packages: write

jobs:
deploy:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- uses: actions/checkout@v3
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.PAT }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=edge,branch=main
type=sha
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Build container
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
40 changes: 0 additions & 40 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ on:
push:
branches:
- main
tags:
- "v*"

name: release-please

permissions:
contents: write
pull-requests: write
packages: write

jobs:
release-please:
Expand All @@ -21,40 +18,3 @@ jobs:
release-type: elixir
package-name: shroud.email
bootstrap-sha: b182fc93f050cab66c45bcd08a4701785881e822

deploy:
needs: release-please
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- uses: actions/checkout@v3
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=main
type=sha
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Build container
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 43d0509

Please sign in to comment.