Skip to content

Commit

Permalink
feat(ci): generate release from github action and update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
tgragnato committed Jan 17, 2024
1 parent 8f011fe commit 2381a40
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 17 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: publish

on:
release:
types: [published]

env:
TEST_TAG: ghcr.io/immobiliare/peephole:test
LATEST_TAG: ghcr.io/immobiliare/peephole:latest
NEW_TAG: ghcr.io/immobiliare/peephole:${{ github.event.release.tag_name }}

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_SRE_TOKEN }}
- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: ${{ env.TEST_TAG }}
- name: Test Docker Image
run: |
docker run --rm ${{ env.TEST_TAG }}
- name: Build and push Docker Image
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ env.NEW_TAG }}, ${{ env.LATEST_TAG }}
push: true
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Create release

on:
workflow_dispatch:

jobs:
changelog:
name: Create changelog
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v5
with:
preset: conventionalcommits
github-token: ${{ secrets.GH_SRE_TOKEN }}
git-user-name: ${{ github.actor }}
git-user-email: ${{ github.actor }}@users.noreply.github.com
tag-prefix: ''
input-file: '.github/CHANGELOG.md'
output-file: '.github/CHANGELOG.md'
release-count: 10000
skip-on-empty: false
skip-version-file: true

- name: Create Release
uses: softprops/action-gh-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
token: ${{ secrets.GH_SRE_TOKEN }}
25 changes: 8 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,16 @@ jobs:
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_ACTIONS_PEEPHOLE }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
password: ${{ secrets.GH_SRE_TOKEN }}
- uses: docker/build-push-action@v5
with:
context: .
tags: ghcr.io/immobiliare/peephole:next
push: true
tags: ghcr.io/immobiliare/peephole:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit 2381a40

Please sign in to comment.