mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-30 11:19:12 +01:00
109 lines
3.5 KiB
YAML
109 lines
3.5 KiB
YAML
name: "[Deployment] Release"
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- closed
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
inputs:
|
|
send-notifications:
|
|
type: boolean
|
|
required: false
|
|
default: true
|
|
description: Send notifications
|
|
push-image:
|
|
type: boolean
|
|
required: false
|
|
default: true
|
|
description: Push image to remote repository
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
env:
|
|
SKIP_ENV_VALIDATION: true
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
TURBO_TELEMETRY_DISABLED: 1
|
|
|
|
concurrency: production
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Deploy docker image
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node-version: [20]
|
|
steps:
|
|
- name: Discord notification
|
|
if: ${{ github.events.inputs.send-notifications }}
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: Ilshidur/action-discord@master
|
|
with:
|
|
args: "Deployment of an image has been triggered: [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
|
|
- uses: actions/checkout@v4
|
|
- name: Get Next Version
|
|
id: semver
|
|
uses: ietf-tools/semver-action@v1
|
|
with:
|
|
token: ${{ github.token }}
|
|
branch: dev
|
|
- name: Discord notification
|
|
if: ${{ github.events.inputs.send-notifications }}
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: Ilshidur/action-discord@master
|
|
with:
|
|
args: "Semver computed next tag to be ${{ steps.semver.outputs.next }}. Current is ${{ steps.semver.outputs.current }}"
|
|
- uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 8
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: "pnpm"
|
|
- name: Discord notification
|
|
if: ${{ github.events.inputs.send-notifications }}
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: Ilshidur/action-discord@master
|
|
with:
|
|
args: "Built application artifacts. Building images..."
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=raw,value=${{ steps.semver.outputs.next }}
|
|
- name: Build and push
|
|
id: buildPushAction
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: linux/amd64 # we currently do't build for linux/arm64 as it's really slow and we'll move to a self hosted runner for that or use the official github runner, once it's available
|
|
context: .
|
|
push: ${{ github.events.inputs.push-image }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
network: host
|
|
env:
|
|
SKIP_ENV_VALIDATION: true
|
|
- name: Discord notification
|
|
if: ${{ github.events.inputs.send-notifications }}
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: Ilshidur/action-discord@master
|
|
with:
|
|
args: "Deployment of image has completed. Image ID is '${{ steps.buildPushAction.outputs.imageid }}'. This was a dry run."
|