Skip to content

Commit

Permalink
ci(github-actions): add semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
OliRafa committed Mar 24, 2024
1 parent ae68e62 commit 88ecb65
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 8 deletions.
44 changes: 36 additions & 8 deletions .github/workflows/continuous_delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ name: Continuous Delivery

on:
push:
tags:
- "*.*.*"
branches:
- main

pull_request:
branches:
- main

workflow_dispatch:

jobs:
build:
Expand All @@ -12,27 +18,49 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "14"

- name: Release to GitHub
id: semantic-releases
uses: cycjimmy/[email protected]
with:
semantic_version: 18.0.0
extra_plugins: |
@semantic-release/[email protected]
@semantic-release/git
branches: |
['main']
env:
GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
if: steps.semantic-releases.outputs.new_release_published == 'true'
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/tastytrade-ghostfolio
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=semver,pattern={{version}},value=${{ steps.semantic-releases.outputs.new_release_version }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semantic-releases.outputs.new_release_version }}
type=semver,pattern={{major}},value=${{ steps.semantic-releases.outputs.new_release_version }}
- name: Login to Docker Hub
uses: docker/login-action@v3
if: steps.semantic-releases.outputs.new_release_published == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

if: steps.semantic-releases.outputs.new_release_published == 'true'

- name: Build and Publish to Docker Hub
uses: docker/build-push-action@v5
if: steps.semantic-releases.outputs.new_release_published == 'true'
with:
context: .
platforms: linux/amd64
Expand Down
26 changes: 26 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md",
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file."
}
],
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md"
],
"message": "chore(release): version ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}

0 comments on commit 88ecb65

Please sign in to comment.