Merge ci-for-auto-update to main

This commit is contained in:
TrainDoctor
2022-09-04 18:18:51 -07:00
parent acaf6c72e4
commit 5f469bfb16
6 changed files with 84 additions and 82 deletions

View File

@@ -54,11 +54,18 @@ jobs:
run: pyinstaller --noconfirm --onefile --name "PluginLoader" --add-data ./backend/static:/static --add-data ./backend/legacy:/legacy ./backend/*.py
- name: Upload package artifact ⬆️
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v3
with:
name: PluginLoader
path: ./dist/PluginLoader
- name: Download package artifact locally
if: ${{ env.ACT }}
uses: actions/upload-artifact@v3
with:
path: ./dist/PluginLoader
release:
name: Release the package
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'release' }}
@@ -77,6 +84,7 @@ jobs:
- name: Release 📦
uses: softprops/action-gh-release@v1
if: ${{ !env.ACT }}
with:
name: Release ${{ steps.tag_version.outputs.new_tag }}
tag_name: ${{ steps.tag_version.outputs.new_tag }}
@@ -90,6 +98,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install semver-tool asdf
uses: asdf-vm/actions/install@v1
with:
tool_versions: |
semver 3.3.0
- name: Checkout 🧰
uses: actions/checkout@v3
@@ -99,12 +113,6 @@ jobs:
name: PluginLoader
path: dist
- name: Install semver-tool asdf
uses: asdf-vm/actions/install@v1
with:
tool_versions: |
semver 3.3.0
- name: Get tag 🏷️
id: old_tag
uses: rafarlopes/get-latest-pre-release-tag-action@v1
@@ -124,89 +132,17 @@ jobs:
- name: Push tag 📤
uses: rickstaa/action-create-tag@v1.3.2
if: ${{ steps.ready_tag.outputs.tag_name && github.event_name == 'workflow_dispatch' }}
if: ${{ steps.ready_tag.outputs.tag_name && github.event_name == 'workflow_dispatch' && !env.ACT }}
with:
tag: ${{ steps.ready_tag.outputs.tag_name }}
message: Pre-release ${{ steps.ready_tag.outputs.tag_name }}
- name: Release 📦
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'workflow_dispatch' }}
if: ${{ github.event_name == 'workflow_dispatch' && !env.ACT }}
with:
name: Prerelease ${{ steps.ready_tag.outputs.tag_name }}
tag_name: ${{ steps.ready_tag.outputs.tag_name }}
files: ./dist/PluginLoader
prerelease: true
generate_release_notes: true
# nightly:
# name: Release the nightly version of the package
# if: ${{ github.event_name == 'schedule' }}
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Checkout 🧰
# uses: actions/checkout@v3
# - name: Fetch package artifact ⬇️
# uses: actions/download-artifact@v3
# with:
# name: PluginLoader
# path: dist
# - name: Get tag 🏷️
# id: old_tag
# uses: rafarlopes/get-latest-pre-release-tag-action@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# repository: 'decky-loader'
# - name: Prepare tag ⚙️
# id: ready_tag
# run: |
# export VERSION=${{ steps.old_tag.outputs.tag }}
# export COMMIT=$(git log -1 --pretty=format:%h)
# echo ::set-output name=tag_name::$(sed -r 's/(-.*)?-pre$//' <<< $VERSION)-$COMMIT-nightly
# - name: Push tag 📤
# uses: rickstaa/action-create-tag@v1.3.2
# if: ${{ steps.ready_tag.outputs.tag_name && github.event_name == 'workflow_dispatch' }}
# with:
# tag: ${{ steps.ready_tag.outputs.tag_name }}
# message: Nightly ${{ steps.ready_tag.outputs.tag_name }}
# - name: Release 📦
# uses: softprops/action-gh-release@v1
# if: ${{ github.event_name == 'workflow_dispatch' }}
# with:
# name: Prerelease ${{ steps.ready_tag.outputs.tag_name }}
# tag_name: ${{ steps.ready_tag.outputs.tag_name }}
# files: ./dist/PluginLoader
# prerelease: true
# generate_release_notes: true
# - name: Bump prerelease ⏫
# id: bump
# if: ${{ github.event_name == 'schedule' }}
# run: |
# git_hash=$(git rev-parse --short "$GITHUB_SHA")
# echo ::set-output new_tag="nightly-$git_hash"
# - name: Push tag 📤
# uses: rickstaa/action-create-tag@v1.3.2
# if: ${{ github.event_name == 'schedule' }}
# with:
# tag: ${{ steps.bump.outputs.new_tag }}
# message: Nightly ${{ steps.bump.outputs.new_tag }}
# - name: Release 📦
# uses: softprops/action-gh-release@v1
# if: ${{ github.event_name == 'schedule' }}
# with:
# name: Nightly ${{ steps.bump.outputs.new_tag }}
# tag_name: ${{ steps.bump.outputs.new_tag }}
# files: ./dist/PluginLoader
# prerelease: true
# generate_release_notes: true

2
.gitignore vendored
View File

@@ -160,3 +160,5 @@ backend/static
# plugins folder for local launches
plugins/*
act/.directory
act/artifacts/*

10
act/artifacts/readme Normal file
View File

@@ -0,0 +1,10 @@
this directory contains artifacts generated by invocations of https://github.com/nektos/act in order to do local testing of binary builds
how to?
run:
./act/run-act.sh prerelease
or
./act/run-act.sh release

5
act/prerelease.json Normal file
View File

@@ -0,0 +1,5 @@
{
"inputs": {
"release": "prerelease"
}
}

5
act/release.json Normal file
View File

@@ -0,0 +1,5 @@
{
"inputs": {
"release": "release"
}
}

44
act/run-act.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
type=$1
oldartifactsdir="old"
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cd "$parent_path"
artifactfolders=$(find artifacts/ -maxdepth 1 -mindepth 1 -type d)
if [[ ${#artifactfolders[@]} > 0 ]]; then
for i in ${artifactfolders[@]}; do
foldername=$(dirname $i)
subfoldername=$(basename $i)
out=$foldername/$oldartifactsdir/$subfoldername-$(date +'%s')
if [[ ! "$subfoldername" =~ "$oldartifactsdir" ]]; then
mkdir -p $out
mv $i $out
printf "Moved "${foldername}"/"${subfoldername}" to "${out}" \n"
fi
done
fi
cd ..
if [[ "$type" == "release" ]]; then
printf "release!\n"
act workflow_dispatch -e act/release.json --artifact-server-path act/artifacts
elif [[ "$type" == "prerelease" ]]; then
printf "prerelease!\n"
act workflow_dispatch -e act/prerelease.json --artifact-server-path act/artifacts
else
printf "Release type unspecified/badly specified.\n"
printf "Options: 'release' or 'prerelease'\n"
fi
cd act/artifacts
if [[ -d "1" ]]; then
cd "1/artifact"
cp "PluginLoader.gz__" "PluginLoader.gz"
gzip -d "PluginLoader.gz"
chmod +x PluginLoader
fi