Skip to content

Commit

Permalink
Publish tagged releases
Browse files Browse the repository at this point in the history
  • Loading branch information
njbbaer committed Jan 27, 2024
1 parent ff0da8f commit 7fd125a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 19 deletions.
20 changes: 1 addition & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: build

on:
push:

Expand Down Expand Up @@ -54,22 +55,3 @@ jobs:

- name: Run isort
run: pipenv run isort --check-only .

publish:
needs:
- test
- lint
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Login to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build Docker image
run: docker build -t ghcr.io/${{ github.repository }}:latest .

- name: Push image to GHCR
run: docker push ghcr.io/${{ github.repository }}:latest
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: publish

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Login to GHCR
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build Docker image
run: docker build -t ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} .

- name: Tag image as latest
run: docker tag ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} ghcr.io/${{ github.repository }}:latest

- name: Push versioned tag to GHCR
run: docker push ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}

- name: Push latest tag to GHCR
run: docker push ghcr.io/${{ github.repository }}:latest
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: release

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create GitHub Release
uses: ncipollo/release-action@v1

0 comments on commit 7fd125a

Please sign in to comment.