2020-08-26 16:47:31 +02:00
|
|
|
name: Build addon
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
2024-04-19 16:51:44 +02:00
|
|
|
types: [published]
|
2020-09-16 10:13:29 +02:00
|
|
|
push:
|
2020-08-26 16:47:31 +02:00
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
env:
|
|
|
|
TARGET: nextcloud_backup
|
2021-02-10 15:40:08 +01:00
|
|
|
IMAGE: "hassio-nextcloud-backup"
|
|
|
|
REPOSITORY: ghcr.io/sebclem
|
2024-04-19 16:51:44 +02:00
|
|
|
IMAGE_SOURCE: https://github.com/Sebclem/hassio-nextcloud-backup
|
2020-08-26 16:47:31 +02:00
|
|
|
|
2020-10-12 14:26:45 +02:00
|
|
|
jobs:
|
2024-08-13 13:23:32 +02:00
|
|
|
build-front:
|
2024-04-19 16:51:44 +02:00
|
|
|
name: Build Front
|
2020-10-12 14:26:45 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-04-19 16:51:44 +02:00
|
|
|
- name: Checkout repo
|
2024-04-19 17:21:19 +02:00
|
|
|
uses: actions/checkout@v4
|
2020-10-12 14:26:45 +02:00
|
|
|
|
2024-04-19 16:51:44 +02:00
|
|
|
- name: Enable corepack
|
|
|
|
run: corepack enable
|
|
|
|
|
|
|
|
- name: Setup Node
|
2024-04-19 17:21:19 +02:00
|
|
|
uses: actions/setup-node@v4
|
2021-02-10 15:40:08 +01:00
|
|
|
with:
|
2024-04-19 16:51:44 +02:00
|
|
|
node-version: 20
|
|
|
|
cache: "pnpm"
|
|
|
|
cache-dependency-path: nextcloud_backup/frontend/pnpm-lock.yaml
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm i
|
|
|
|
working-directory: nextcloud_backup/frontend
|
2021-02-10 15:40:08 +01:00
|
|
|
|
2024-04-19 16:51:44 +02:00
|
|
|
- name: Build
|
|
|
|
run: pnpm build
|
|
|
|
working-directory: nextcloud_backup/frontend
|
|
|
|
|
|
|
|
- name: Upload production-ready build files
|
2024-04-19 17:21:19 +02:00
|
|
|
uses: actions/upload-artifact@v4
|
2021-02-10 15:40:08 +01:00
|
|
|
with:
|
2024-04-19 17:21:19 +02:00
|
|
|
name: front_dist
|
|
|
|
path: nextcloud_backup/frontend/dist/
|
2024-04-19 16:51:44 +02:00
|
|
|
|
2024-08-13 13:23:32 +02:00
|
|
|
build-back:
|
2024-08-13 13:26:11 +02:00
|
|
|
name: Build back
|
2024-08-13 13:23:32 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Enable corepack
|
|
|
|
run: corepack enable
|
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v4
|
|
|
|
with:
|
|
|
|
node-version: 20
|
|
|
|
cache: "pnpm"
|
|
|
|
cache-dependency-path: nextcloud_backup/backend/pnpm-lock.yaml
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm i
|
|
|
|
working-directory: nextcloud_backup/backend
|
|
|
|
|
|
|
|
- name: Lint
|
|
|
|
run: pnpm lint
|
|
|
|
working-directory: nextcloud_backup/backend
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: pnpm build
|
|
|
|
working-directory: nextcloud_backup/backend
|
|
|
|
|
|
|
|
- name: Upload production-ready build files
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
2024-08-13 13:26:11 +02:00
|
|
|
name: back_dist
|
2024-08-13 13:23:32 +02:00
|
|
|
path: nextcloud_backup/backend/dist/
|
|
|
|
|
2024-08-13 13:47:22 +02:00
|
|
|
build-dockers:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2024-08-13 15:55:24 +02:00
|
|
|
arch: [ aarch64, amd64, armv7 ]
|
2024-08-13 13:47:22 +02:00
|
|
|
include:
|
|
|
|
- arch: aarch64
|
|
|
|
arch_value: linux/arm64/v8
|
|
|
|
- arch: amd64
|
|
|
|
arch_value: linux/amd64
|
|
|
|
- arch: armv7
|
|
|
|
arch_value: linux/arm/v7
|
2024-08-13 15:35:35 +02:00
|
|
|
|
2024-08-13 13:47:22 +02:00
|
|
|
steps:
|
|
|
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx ${{matrix.arch}}
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
- name: Get build option ${{matrix.arch}}
|
|
|
|
run: |
|
|
|
|
echo "NAME=$(jq --raw-output '.name // empty' "${{env.TARGET}}/config.json" | sed "s/'//g")" >> $GITHUB_ENV
|
|
|
|
echo "DESCRIPTION=$(jq --raw-output '.description // empty' "${{env.TARGET}}/config.json" | sed "s/'//g")" >> $GITHUB_ENV
|
|
|
|
echo "URL=$(jq --raw-output '.url // empty' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV
|
|
|
|
echo "VERSION=$(jq --raw-output '.version' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV
|
|
|
|
echo "BUILD_FROM=ghcr.io/home-assistant/${{matrix.arch}}-base:$(cat nextcloud_backup/.base_version)" >> $GITHUB_ENV
|
|
|
|
|
2024-08-13 16:06:17 +02:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{env.REPOSITORY}}/${{env.IMAGE}}
|
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
labels: |
|
|
|
|
io.hass.name=${{env.NAME}}
|
|
|
|
io.hass.description=${{env.DESCRIPTION}}
|
|
|
|
io.hass.url=${{env.URL}}
|
|
|
|
io.hass.arch=${{matrix.arch}}
|
|
|
|
io.hass.version={{version}}
|
|
|
|
io.hass.type=addon
|
2024-08-13 13:47:22 +02:00
|
|
|
|
|
|
|
- name: Debug Env
|
|
|
|
run: |
|
2024-08-13 16:06:17 +02:00
|
|
|
echo ${{ steps.meta.outputs.tags }}
|
|
|
|
echo ${{ steps.meta.outputs.labels }}
|
2024-08-13 13:47:22 +02:00
|
|
|
|
|
|
|
- name: Login to ghcr.io
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build and push ${{matrix.arch}}
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2024-08-13 16:06:17 +02:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2024-08-13 13:47:22 +02:00
|
|
|
build-args: |
|
|
|
|
BUILD_FROM=${{env.BUILD_FROM}}
|
|
|
|
file: ./${{env.TARGET}}/Dockerfile
|
|
|
|
cache-from: type=registry,ref=${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:latest
|
|
|
|
cache-to: type=inline
|
|
|
|
context: ./${{env.TARGET}}/
|
|
|
|
platforms: ${{ matrix.arch_value }}
|