Skip to content

Merge pull request #74 from podtato-head/renovate/google-github-actio… #66

Merge pull request #74 from podtato-head/renovate/google-github-actio…

Merge pull request #74 from podtato-head/renovate/google-github-actio… #66

name: Run Release Please
on:
push:
branches:
- main
- '[0-9]+.[0-9]+.x'
workflow_dispatch:
defaults:
run:
shell: bash
env:
# Default minimum version of Go to support.
DEFAULT_GO_VERSION: 1.20
REGISTRY: ghcr.io
IMAGE_NAME: podtato-server
GITHUB_PAGES_BRANCH: gh-pages
jobs:
release-please:
permissions:
contents: write # for google-github-actions/release-please-action to create release commit
pull-requests: write # for google-github-actions/release-please-action to create release PR
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
# Release-please creates a PR that tracks all changes
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: google-github-actions/release-please-action@v4
id: release
with:
command: manifest
token: ${{secrets.GITHUB_TOKEN}}
default-branch: main
build-release:
if: needs.release-please.outputs.releases_created == 'true'
needs:
- release-please
runs-on: ubuntu-22.04
permissions:
contents: write
packages: write
id-token: write
env:
IMAGE_TAG: ghcr.io/podtato-head/podtato-server:${{ needs.release-please.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
target: production
tags: |
${{ env.IMAGE_TAG }}
build-args: |
GIT_HASH=${{ env.GIT_SHA }}
RELEASE_VERSION=dev-${{ env.DATETIME }}
BUILD_TIME=${{ env.BUILD_TIME }}
builder: ${{ steps.buildx.outputs.name }}
push: true
cache-from: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_NAME }}
cache-to: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_NAME }}
- name: Write vars
id: vars
shell: bash
run: |
TAG=${{ needs.release-please.outputs.tag_name }}
echo "version=${TAG#v}" >> $GITHUB_OUTPUT
- name: Publish Helm chart to GHCR
run: |
helm package chart
helm push podtato-head-${{ steps.vars.outputs.version }}.tgz oci://ghcr.io/podtato-head/charts
- name: Generate SBOM
uses: anchore/[email protected]
with:
image: ${{ env.IMAGE_TAG }}
artifact-name: sbom-${{ env.IMAGE_NAME }}
output-file: ./sbom-${{ env.IMAGE_NAME }}.spdx.json
- name: Attach SBOM to release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release-please.outputs.tag_name }}
files: ./sbom-${{ env.IMAGE_NAME }}.spdx.json
release-manifests:
if: needs.release-please.outputs.releases_created == 'true'
needs:
- release-please
- build-release
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Attach release assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release-please.outputs.tag_name }}
files: deploy/manifest.yaml