Merge pull request #163 from netboxlabs/develop #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Server - release | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ release ] | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: false | |
env: | |
GH_TOKEN: ${{ secrets.ORB_CI_GH_TOKEN }} | |
SEMANTIC_RELEASE_PACKAGE: ${{ github.repository }} | |
GO_VERSION: '1.22' | |
jobs: | |
setup: | |
name: Setup | |
runs-on: ubuntu-latest | |
outputs: | |
apps: ${{ steps.apps.outputs.apps }} | |
steps: | |
- name: Get apps | |
id: apps | |
run: | | |
echo 'apps=["ingester", "reconciler"]' >> "$GITHUB_OUTPUT" | |
get-next-version: | |
name: Get next version - ${{ matrix.app }} | |
needs: [ setup ] | |
uses: netboxlabs/diode/.github/workflows/reusable_semantic_release_get_next_version.yaml@develop | |
strategy: | |
fail-fast: false | |
matrix: | |
app: ${{ fromJSON(needs.setup.outputs.apps) }} | |
with: | |
app_name: diode-${{ matrix.app }} | |
app_dir: diode-server | |
secrets: inherit | |
build: | |
name: Build - ${{ matrix.app }} | |
needs: [ setup, get-next-version ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
app: ${{ fromJSON(needs.setup.outputs.apps) }} | |
if: needs.get-next-version.outputs.new-release-published == 'true' | |
env: | |
BUILD_VERSION: ${{ needs.get-next-version.outputs.new-release-version }} | |
BUILD_COMMIT: ${{ needs.get-next-version.outputs.short-sha }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set build info | |
run: | | |
echo $BUILD_COMMIT > ./diode-server/version/BUILD_COMMIT.txt | |
echo $BUILD_VERSION > ./diode-server/version/BUILD_VERSION.txt | |
- name: Build image and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: diode-server | |
file: diode-server/docker/Dockerfile-build | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: | | |
netboxlabs/diode-${{ matrix.app }}:latest | |
netboxlabs/diode-${{ matrix.app }}:${{ env.BUILD_VERSION }} | |
build-args: | | |
GO_VERSION=${{ env.GO_VERSION }} | |
SVC=${{ matrix.app }} | |
semantic-release: | |
name: Semantic release - ${{ matrix.app }} | |
uses: netboxlabs/diode/.github/workflows/reusable_semantic_release.yaml@develop | |
needs: [ setup, build ] | |
strategy: | |
fail-fast: false | |
matrix: | |
app: ${{ fromJSON(needs.setup.outputs.apps) }} | |
with: | |
app_name: diode-${{ matrix.app }} | |
app_dir: diode-server | |
secrets: inherit |