mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-22 01:02:59 +01:00
Change build workflow
This commit is contained in:
parent
8bd224affe
commit
355d5cdf91
202
.github/workflows/build_addon.yml
vendored
202
.github/workflows/build_addon.yml
vendored
@ -2,7 +2,7 @@ name: Build addon
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [ published ]
|
||||
types: [published]
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
@ -10,98 +10,126 @@ env:
|
||||
TARGET: nextcloud_backup
|
||||
IMAGE: "hassio-nextcloud-backup"
|
||||
REPOSITORY: ghcr.io/sebclem
|
||||
IMAGE_SOURCE : https://github.com/Sebclem/hassio-nextcloud-backup
|
||||
|
||||
|
||||
IMAGE_SOURCE: https://github.com/Sebclem/hassio-nextcloud-backup
|
||||
|
||||
jobs:
|
||||
build-dockers:
|
||||
build-font:
|
||||
name: Build Front
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [ aarch64, amd64, armv7, i386, armhf ]
|
||||
include:
|
||||
- arch: aarch64
|
||||
arch_value: linux/arm64/v8
|
||||
- arch: amd64
|
||||
arch_value: linux/amd64
|
||||
- arch: armv7
|
||||
arch_value: linux/arm/v7
|
||||
- arch: i386
|
||||
arch_value: linux/386
|
||||
- arch: armhf
|
||||
arch_value: linux/arm/v6
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- name: Enable corepack
|
||||
run: corepack enable
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx ${{matrix.arch}}
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Set Version Prod ${{matrix.arch}}
|
||||
if: github.event_name != 'workflow_dispatch' && github.event_name != 'push'
|
||||
run: |
|
||||
version=${GITHUB_REF/refs\/tags\//}
|
||||
if [ -n "$version" ];then
|
||||
tmp=$(mktemp)
|
||||
jq --arg version "$version" '.version=$version' ${{env.TARGET}}/config.json > "$tmp" && mv "$tmp" ${{env.TARGET}}/config.json
|
||||
fi
|
||||
echo "version_type=prod" >> $GITHUB_ENV
|
||||
- name: Set Version Test ${{matrix.arch}}
|
||||
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
|
||||
run: |
|
||||
version=dev_${GITHUB_RUN_ID}
|
||||
if [ -n "$version" ];then
|
||||
tmp=$(mktemp)
|
||||
jq --arg version "$version" '.version=$version' ${{env.TARGET}}/config.json > "$tmp" && mv "$tmp" ${{env.TARGET}}/config.json
|
||||
fi
|
||||
echo "version_type=dev" >> $GITHUB_ENV
|
||||
|
||||
|
||||
- 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/hassio-addons/base/${{matrix.arch}}:$(cat nextcloud_backup/.base_version)" >> $GITHUB_ENV
|
||||
|
||||
- name: Set Tags ${{matrix.arch}}
|
||||
run: |
|
||||
if [ "${{env.version_type}}" != "dev" ]; then
|
||||
echo "TAGS=${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:latest, ${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:$(jq --raw-output '.version' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV
|
||||
else
|
||||
echo "TAGS=${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:dev, ${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:$(jq --raw-output '.version' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Debug Env
|
||||
run: |
|
||||
echo ${{env.VERSION}}
|
||||
echo ${{env.TAGS}}
|
||||
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@v2
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
node-version: 20
|
||||
cache: "pnpm"
|
||||
cache-dependency-path: nextcloud_backup/frontend/pnpm-lock.yaml
|
||||
|
||||
- name: Build and push ${{matrix.arch}}
|
||||
uses: docker/build-push-action@v3
|
||||
- name: Install dependencies
|
||||
run: pnpm i
|
||||
working-directory: nextcloud_backup/frontend
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
working-directory: nextcloud_backup/frontend
|
||||
|
||||
- name: Upload production-ready build files
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{env.TAGS}}
|
||||
labels: io.hass.name=${{env.NAME}}, io.hass.description=${{env.DESCRIPTION}}, io.hass.url=${{env.URL}}, io.hass.arch=${{matrix.arch}}, io.hass.version=${{env.VERSION}}, io.hass.type=addon
|
||||
build-args: |
|
||||
BUILD_FROM=${{env.BUILD_FROM}}
|
||||
BUILD_VERSION=${{env.VERSION}}
|
||||
IMAGE_SOURCE=${{env.IMAGE_SOURCE}}
|
||||
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 }}
|
||||
name: production-files
|
||||
path: ./nextcloud/frontend/dist
|
||||
|
||||
# build-dockers:
|
||||
# runs-on: ubuntu-latest
|
||||
# strategy:
|
||||
# fail-fast: false
|
||||
# matrix:
|
||||
# arch: [ aarch64, amd64, armv7, i386, armhf ]
|
||||
# include:
|
||||
# - arch: aarch64
|
||||
# arch_value: linux/arm64/v8
|
||||
# - arch: amd64
|
||||
# arch_value: linux/amd64
|
||||
# - arch: armv7
|
||||
# arch_value: linux/arm/v7
|
||||
# - arch: i386
|
||||
# arch_value: linux/386
|
||||
# - arch: armhf
|
||||
# arch_value: linux/arm/v6
|
||||
# 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: Set Version Prod ${{matrix.arch}}
|
||||
# if: github.event_name != 'workflow_dispatch' && github.event_name != 'push'
|
||||
# run: |
|
||||
# version=${GITHUB_REF/refs\/tags\//}
|
||||
# if [ -n "$version" ];then
|
||||
# tmp=$(mktemp)
|
||||
# jq --arg version "$version" '.version=$version' ${{env.TARGET}}/config.json > "$tmp" && mv "$tmp" ${{env.TARGET}}/config.json
|
||||
# fi
|
||||
# echo "version_type=prod" >> $GITHUB_ENV
|
||||
# - name: Set Version Test ${{matrix.arch}}
|
||||
# if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
|
||||
# run: |
|
||||
# version=dev_${GITHUB_RUN_ID}
|
||||
# if [ -n "$version" ];then
|
||||
# tmp=$(mktemp)
|
||||
# jq --arg version "$version" '.version=$version' ${{env.TARGET}}/config.json > "$tmp" && mv "$tmp" ${{env.TARGET}}/config.json
|
||||
# fi
|
||||
# echo "version_type=dev" >> $GITHUB_ENV
|
||||
|
||||
# - 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/hassio-addons/base/${{matrix.arch}}:$(cat nextcloud_backup/.base_version)" >> $GITHUB_ENV
|
||||
|
||||
# - name: Set Tags ${{matrix.arch}}
|
||||
# run: |
|
||||
# if [ "${{env.version_type}}" != "dev" ]; then
|
||||
# echo "TAGS=${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:latest, ${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:$(jq --raw-output '.version' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV
|
||||
# else
|
||||
# echo "TAGS=${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:dev, ${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}:$(jq --raw-output '.version' "${{env.TARGET}}/config.json")" >> $GITHUB_ENV
|
||||
# fi
|
||||
|
||||
# - name: Debug Env
|
||||
# run: |
|
||||
# echo ${{env.VERSION}}
|
||||
# echo ${{env.TAGS}}
|
||||
|
||||
# - 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' }}
|
||||
# tags: ${{env.TAGS}}
|
||||
# labels: io.hass.name=${{env.NAME}}, io.hass.description=${{env.DESCRIPTION}}, io.hass.url=${{env.URL}}, io.hass.arch=${{matrix.arch}}, io.hass.version=${{env.VERSION}}, io.hass.type=addon
|
||||
# build-args: |
|
||||
# BUILD_FROM=${{env.BUILD_FROM}}
|
||||
# BUILD_VERSION=${{env.VERSION}}
|
||||
# IMAGE_SOURCE=${{env.IMAGE_SOURCE}}
|
||||
# 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 }}
|
||||
|
Loading…
Reference in New Issue
Block a user