diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index fd1d926f..00000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,88 +0,0 @@ -name: Publish - -on: - push: - branches: - - main - -jobs: - build-and-publish: - name: "Build and Push Docker Images" - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and Push API Docker Image - uses: docker/build-push-action@v5 - with: - context: ./api/ - push: true - tags: ghcr.io/${{ github.repository_owner }}/outdated/api:latest - - - name: Build and Push Ember Docker Image - uses: docker/build-push-action@v5 - with: - context: ./ember/ - push: true - tags: ghcr.io/${{ github.repository_owner }}/outdated/ember:latest - - helm-chart: - name: "Push Helm Chart" - runs-on: ubuntu-latest - needs: - build-and-publish - permissions: - actions: none - checks: none - contents: none - deployments: none - issues: none - packages: write - pull-requests: none - repository-projects: none - security-events: none - statuses: none - id-token: none - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Prepare Chart Metadata - id: chartmeta - run: echo version=0.0.0+$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT - - - name: Set up Helm - uses: azure/setup-helm@v3.5 - with: - version: v3.12.0 - - - name: Package Chart - run: | - helm repo add bitnami https://charts.bitnami.com/bitnami - helm dependency build charts/outdated - helm package --version ${{ steps.chartmeta.outputs.version }} --app-version ${{ steps.chartmeta.outputs.version }} --destination=dist charts/outdated - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Push Chart - run: helm push dist/*.tgz oci://ghcr.io/adfinis/outdated/helm \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..4a088139 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,90 @@ +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: 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 + + - 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.12.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 --version ${{ steps.semrel.outputs.version }} --app-version ${{ steps.semrel.outputs.version }} --destination=dist charts/outdated + + - name: Push Chart + if: steps.semrel.outputs.version != '' + run: helm push dist/*.tgz oci://ghcr.io/${{ github.repository }}/helm +