mirror of
https://github.com/ep1cman/unifi-protect-backup.git
synced 2025-12-10 13:23:29 +00:00
Update CI flows to build arm64 containers
This commit is contained in:
45
.github/workflows/dev.yml
vendored
45
.github/workflows/dev.yml
vendored
@@ -2,16 +2,13 @@
|
|||||||
|
|
||||||
name: dev workflow
|
name: dev workflow
|
||||||
|
|
||||||
env:
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
# Controls when the action will run.
|
# Controls when the action will run.
|
||||||
on:
|
on:
|
||||||
# Triggers the workflow on push or pull request events but only for the master branch
|
# Triggers the workflow on push or pull request events but only for the master branch
|
||||||
push:
|
push:
|
||||||
branches: [ master, main, dev ]
|
branches: [ dev ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master, main, dev ]
|
branches: [ dev ]
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -56,9 +53,6 @@ jobs:
|
|||||||
name: Create dev container
|
name: Create dev container
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-versions: [3.9]
|
|
||||||
|
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
steps:
|
steps:
|
||||||
@@ -67,7 +61,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-versions }}
|
python-version: 3.9
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -78,20 +72,23 @@ jobs:
|
|||||||
run: >-
|
run: >-
|
||||||
poetry build
|
poetry build
|
||||||
|
|
||||||
- name: build container
|
- name: Set up QEMU
|
||||||
id: docker_build
|
uses: docker/setup-qemu-action@v1
|
||||||
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
|
|
||||||
|
|
||||||
- name: log in to container registry
|
- name: Set up Docker Buildx
|
||||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Log in to container registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: push container image
|
- name: Build and push dev
|
||||||
run: |
|
uses: docker/build-push-action@v2
|
||||||
IMAGE_ID=ghcr.io/$IMAGE_NAME
|
with:
|
||||||
|
context: .
|
||||||
# Change all uppercase to lowercase
|
platforms: linux/amd64,linux/arm64
|
||||||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
push: true
|
||||||
echo IMAGE_ID=$IMAGE_ID
|
tags: ghcr.io/${{ github.repository }}:dev
|
||||||
echo VERSION=$VERSION
|
|
||||||
docker tag $IMAGE_NAME $IMAGE_ID:dev
|
|
||||||
docker push $IMAGE_ID:dev
|
|
||||||
50
.github/workflows/preview.yml
vendored
50
.github/workflows/preview.yml
vendored
@@ -1,50 +0,0 @@
|
|||||||
# This is a basic workflow to help you get started with Actions
|
|
||||||
|
|
||||||
name: stage & preview workflow
|
|
||||||
|
|
||||||
# Controls when the action will run.
|
|
||||||
on:
|
|
||||||
# Triggers the workflow on push or pull request events but only for the master branch
|
|
||||||
push:
|
|
||||||
branches: [ master, main ]
|
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
||||||
jobs:
|
|
||||||
publish_dev_build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-versions: [ 3.9 ]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-versions }}
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install poetry tox tox-gh-actions
|
|
||||||
|
|
||||||
- name: test with tox
|
|
||||||
run:
|
|
||||||
tox
|
|
||||||
|
|
||||||
- name: Build wheels and source tarball
|
|
||||||
run: |
|
|
||||||
poetry version $(poetry version --short)-dev.$GITHUB_RUN_NUMBER
|
|
||||||
poetry version --short
|
|
||||||
poetry build
|
|
||||||
|
|
||||||
- name: publish to Test PyPI
|
|
||||||
uses: pypa/gh-action-pypi-publish@master
|
|
||||||
with:
|
|
||||||
user: __token__
|
|
||||||
password: ${{ secrets.TEST_PYPI_API_TOKEN}}
|
|
||||||
repository_url: https://test.pypi.org/legacy/
|
|
||||||
skip_existing: true
|
|
||||||
53
.github/workflows/release.yml
vendored
53
.github/workflows/release.yml
vendored
@@ -12,9 +12,6 @@ on:
|
|||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
jobs:
|
jobs:
|
||||||
# This workflow contains a single job called "release"
|
# This workflow contains a single job called "release"
|
||||||
@@ -22,10 +19,6 @@ jobs:
|
|||||||
name: Create Release
|
name: Create Release
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-versions: [3.9]
|
|
||||||
|
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
steps:
|
steps:
|
||||||
- name: Get version from tag
|
- name: Get version from tag
|
||||||
@@ -46,7 +39,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-versions }}
|
python-version: 3.9
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -61,12 +54,26 @@ jobs:
|
|||||||
run: >-
|
run: >-
|
||||||
ls -l
|
ls -l
|
||||||
|
|
||||||
- name: build container
|
- name: Set up QEMU
|
||||||
id: docker_build
|
uses: docker/setup-qemu-action@v1
|
||||||
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
|
|
||||||
|
|
||||||
- name: log in to container registry
|
- name: Set up Docker Buildx
|
||||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Log in to container registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push dev
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/${{ github.repository }}:$VERSION, ghcr.io/${{ github.repository }}:latest
|
||||||
|
|
||||||
- name: create github release
|
- name: create github release
|
||||||
id: create_release
|
id: create_release
|
||||||
@@ -79,26 +86,6 @@ jobs:
|
|||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|
||||||
- name: push container image
|
|
||||||
run: |
|
|
||||||
IMAGE_ID=ghcr.io/$IMAGE_NAME
|
|
||||||
|
|
||||||
# Change all uppercase to lowercase
|
|
||||||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
|
||||||
# Strip git ref prefix from version
|
|
||||||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
|
||||||
# Strip "v" prefix from tag name
|
|
||||||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
|
||||||
# Use Docker `latest` tag convention
|
|
||||||
[ "$VERSION" == "master" ] && VERSION=latest
|
|
||||||
echo IMAGE_ID=$IMAGE_ID
|
|
||||||
echo VERSION=$VERSION
|
|
||||||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
|
|
||||||
docker tag $IMAGE_NAME $IMAGE_ID:latest
|
|
||||||
docker push $IMAGE_ID:$VERSION
|
|
||||||
docker push $IMAGE_ID:latest
|
|
||||||
|
|
||||||
|
|
||||||
- name: publish to PyPI
|
- name: publish to PyPI
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user