#444 issue during batch tags renaming: type issue. Refactored the hel… #95
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: build_accessmod | |
on: | |
push: | |
branches: | |
- staging | |
- release | |
env: | |
DOCKER_REPO: "fredmoser" | |
DOCKER_NAME: "accessmod" | |
DOCKER_TAG_TEST: "test" | |
DOCKER_TAG_LATEST: "latest" | |
PACKER_VERSION: "1.10.1" | |
jobs: | |
# _ _ | |
# | | | | | |
# __| | ___ ____| | _ _____ ____ | |
# / _ |/ _ \ / ___) |_/ ) ___ |/ ___) | |
# ( (_| | |_| ( (___| _ (| ____| | | |
# \____|\___/ \____)_| \_)_____)_| | |
# | |
docker: | |
runs-on: ubuntu-latest | |
name: Test and build docker images | |
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: Get version | |
id: get_version | |
run: echo "AM_VERSION=$(cat version.txt)" >> $GITHUB_ENV | |
- name: Build test version | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
load: true | |
tags: ${{ env.DOCKER_REPO }}/${{ env.DOCKER_NAME }}:${{ env.DOCKER_TAG_TEST }} | |
- name: Run tests | |
env: | |
DOCKER_TAG: "${{ env.DOCKER_TAG_TEST }}" | |
run: ./test.sh | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{ env.DOCKER_REPO }}/${{ env.DOCKER_NAME }}:${{ env.AM_VERSION }} | |
${{ env.DOCKER_REPO }}/${{ env.DOCKER_NAME }}:${{ env.DOCKER_TAG_LATEST }} | |
# _ | |
# | | | |
# ____ _____ ____| | _ _____ ____ | |
# | _ \(____ |/ ___) |_/ ) ___ |/ ___) | |
# | |_| / ___ ( (___| _ (| ____| | | |
# | __/\_____|\____)_| \_)_____)_| | |
# |_| | |
packer: | |
runs-on: ubuntu-22.04 | |
needs: docker | |
if: ${{ github.ref_name == 'release' }} | |
name: Build VirtualBox ova | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies for VirtualBox 7.0.14 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libc6 libqt5core5a libqt5dbus5 libqt5gui5 libqt5help5 libqt5opengl5 libqt5printsupport5 libqt5widgets5 libqt5x11extras5 libqt5xml5 libssl3 libstdc++6 libvpx7 | |
- name: Install VirtualBox 7.0.14 | |
run: | | |
wget https://download.virtualbox.org/virtualbox/7.0.14/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb | |
sudo dpkg -i virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb | |
sudo apt-get install -f -y | |
- name: Setup Packer | |
uses: hashicorp/setup-packer@main | |
with: | |
version: ${{ env.PACKER_VERSION }} | |
- name: Initialize Packer Configuration | |
working-directory: ./packer | |
run: packer init alpine.pkr.hcl | |
env: | |
PACKER_GITHUB_API_TOKEN: ${{ secrets.github_token }} | |
- name: Validate Packer Template | |
working-directory: ./packer | |
run: packer validate alpine.pkr.hcl | |
- name: Build with Packer | |
working-directory: ./packer | |
run: packer build -debug -force alpine.pkr.hcl | |
- name: Upload OVA | |
uses: actions/upload-artifact@v4 | |
with: | |
name: accessmod-virtualbox | |
path: packer/_build | |
# _ | |
# | | _ | |
# _____| | _____ ____ _| |_ ____ ___ ____ | |
# | ___ | || ___ |/ ___|_ _)/ ___) _ \| _ \ | |
# | ____| || ____( (___ | |_| | | |_| | | | | | |
# |_____)\_)_____)\____) \__)_| \___/|_| |_| | |
update_image: | |
runs-on: ubuntu-latest | |
needs: docker | |
if: ${{ github.ref_name == 'release' }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
arch: amd64 | |
- os: macos-14 | |
arch: arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use docker | |
uses: actions-hub/docker/cli@master | |
env: | |
SKIP_LOGIN: true | |
- name: Update image | |
working-directory: ./electron | |
run: ./update_image.sh | |
shell: bash | |
- name: Upload image artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: accessmod-docker-archive-${{ matrix.arch }} | |
path: ./electron/resources/docker/accessmod-docker.tar.gz | |
electron: | |
runs-on: ${{ matrix.os }} | |
needs: update_image | |
if: ${{ github.ref_name == 'release' }} | |
strategy: | |
matrix: | |
include: | |
- os: macos-14 | |
platform: mac | |
arch: arm64 | |
- os: ubuntu-22.04 | |
platform: linux | |
arch: amd64 | |
- os: macos-12 | |
platform: mac | |
arch: amd64 | |
- os: windows-2022 | |
platform: win | |
arch: amd64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: accessmod-docker-archive-${{ matrix.arch }} | |
path: ./electron/resources/docker/ | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- name: Install Dependencies | |
working-directory: ./electron | |
run: yarn install | |
- name: Prepare for app notarization | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
mkdir -p ~/private_keys/ | |
echo '${{ secrets.mac_api_key }}' > ~/private_keys/AuthKey_${{ secrets.mac_api_key_id }}.p8 | |
- name: Build | |
uses: samuelmeuli/action-electron-builder@v1 | |
with: | |
release: false | |
build_script_name: build | |
package_root: ./electron | |
github_token: ${{ secrets.github_token }} | |
mac_certs: ${{ secrets.mac_certs }} | |
mac_certs_password: ${{ secrets.mac_certs_password }} | |
env: | |
APPLE_API_KEY: ~/private_keys/AuthKey_${{ secrets.mac_api_key_id }}.p8 | |
APPLE_API_KEY_ID: ${{ secrets.mac_api_key_id }} | |
APPLE_API_ISSUER: ${{ secrets.mac_api_key_issuer_id }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: accessmod-desktop-${{ matrix.platform }}-${{ matrix.arch }} | |
path: | | |
./electron/dist/*.dmg | |
./electron/dist/*.deb | |
./electron/dist/*-setup.exe | |
# ______ _ | |
# | ___ \ | | | |
# | |_/ /___| | ___ __ _ ___ ___ | |
# | // _ \ |/ _ \/ _` / __|/ _ \ | |
# | |\ \ __/ | __/ (_| \__ \ __/ | |
# \_| \_\___|_|\___|\__,_|___/\___| | |
release: | |
runs-on: ubuntu-latest | |
needs: [docker, packer, electron] | |
if: ${{ github.ref_name == 'release' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get version | |
id: get_version | |
run: echo "AM_VERSION=$(cat version.txt)" >> $GITHUB_ENV | |
- name: Download All Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./accessmod | |
pattern: accessmod-* | |
- name: List downloaded files | |
run: ls -R ./accessmod | |
- name: Rename files to avoid name collisions | |
run: | | |
mv ./accessmod/accessmod-desktop-linux-amd64/accessmod-desktop_5.8.2_amd64.deb \ | |
./accessmod/accessmod-desktop-linux-amd64.deb | |
mv ./accessmod/accessmod-desktop-mac-amd64/accessmod-desktop-5.8.2-x64.dmg \ | |
./accessmod/accessmod-desktop-mac-x64.dmg | |
mv ./accessmod/accessmod-desktop-mac-arm64/accessmod-desktop-5.8.2-arm64.dmg \ | |
./accessmod/accessmod-desktop-mac-arm64.dmg | |
mv ./accessmod/accessmod-desktop-win-amd64/accessmod-desktop-5.8.2-setup.exe \ | |
./accessmod/accessmod-desktop-win-setup.exe | |
mv ./accessmod/accessmod-docker-archive-amd64/accessmod-docker.tar.gz \ | |
./accessmod/accessmod-docker-amd64.tar.gz | |
mv ./accessmod/accessmod-docker-archive-arm64/accessmod-docker.tar.gz \ | |
./accessmod/accessmod-docker-arm64.tar.gz | |
mv ./accessmod/accessmod-virtualbox/vm/alpine-accessmod-5.8.ova \ | |
./accessmod/accessmod-virtualbox.ova | |
- name: Create GitHub Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.AM_VERSION }} | |
files: ./accessmod/* | |
body_path: ./release_notes.md | |
token: ${{ secrets.github_token }} |