Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): add semantic-release #213

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/backend.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Backend

on:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/charts.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Charts

on:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Frontend
on:
push:
Expand Down
88 changes: 0 additions & 88 deletions .github/workflows/publish.yaml

This file was deleted.

97 changes: 97 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
name: Release

on:
push:
branches:
- main

jobs:
semrel:
name: Semantic Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Semantic Release
uses: go-semantic-release/action@v1
id: semrel
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
allow-initial-development-versions: true

- run: pipx install poetry
if: steps.semrel.outputs.version != ''

- name: Adjust Versions
if: steps.semrel.outputs.version != ''
run: |
cd api && poetry version ${{ steps.semrel.outputs.version }} && cd -
cd ember && yarn version --no-commit-hooks --no-git-tag-version --new-version ${{ steps.semrel.outputs.version }}

- name: Adjust Versions in Chart.yaml
if: steps.semrel.outputs.version != ''
uses: mikefarah/yq@v4.41.1
with:
cmd: yq eval '(.appVersion = "${{ steps.semrel.outputs.version }}") | (.version = "{{ steps.semrel.outputs.version }}" )' --inplace ./charts/outdated/Chart.yaml

- name: Release Commit
uses: EndBug/add-and-commit@v9
if: steps.semrel.outputs.version != ''
with:
message: "chore(release): ${{ steps.semrel.outputs.version }} [skip ci]"
default_author: github_actions
add: |
api/pyproject.toml
ember/package.json
charts/outdated/Chart.yaml

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: steps.semrel.outputs.version != ''
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
if: steps.semrel.outputs.version != ''
uses: docker/setup-buildx-action@v3

- name: Build and Push API Docker Image
if: steps.semrel.outputs.version != ''
uses: docker/build-push-action@v5
with:
context: ./api/
push: true
tags: |
ghcr.io/${{ github.repository }}/api:${{ steps.semrel.outputs.version }}
ghcr.io/${{ github.repository }}/api:latest

- name: Build and Push Ember Docker Image
if: steps.semrel.outputs.version != ''
uses: docker/build-push-action@v5
with:
context: ./ember/
push: true
tags: |
ghcr.io/${{ github.repository }}/ember:${{ steps.semrel.outputs.version }}
ghcr.io/${{ github.repository }}/ember:latest

- name: Set up Helm
if: steps.semrel.outputs.version != ''
uses: azure/setup-helm@v3.5
with:
version: v3.14.0

- name: Package Chart
if: steps.semrel.outputs.version != ''
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm dependency build charts/outdated
helm package --destination=dist charts/outdated

- name: Push Chart
if: steps.semrel.outputs.version != ''
run: helm push dist/*.tgz oci://ghcr.io/${{ github.repository }}/helm
Loading