Merge pull request #223 from tabreturn/edgar-mendoza-games #323
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: release | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
concurrency: | |
group: release # only 1 release at a time | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: env - better defaulting of env vars; | |
id: env | |
run: | | |
LARGE_FILE_REPOSITORY="${{ secrets.LARGE_FILE_REPOSITORY }}" | |
if [[ -z "$LARGE_FILE_REPOSITORY" ]]; then | |
LARGE_FILE_REPOSITORY="PortsMaster/PortMaster-Hosting" | |
fi | |
echo "::set-output name=LARGE_FILE_REPOSITORY::$LARGE_FILE_REPOSITORY" | |
LARGE_FILE_TAG="${{ secrets.LARGE_FILE_TAG }}" | |
if [[ -z "$LARGE_FILE_TAG" ]]; then | |
LARGE_FILE_TAG="large-files" | |
fi | |
echo "::set-output name=LARGE_FILE_TAG::$LARGE_FILE_TAG" | |
RELEASE_REPO="${{ secrets.RELEASE_REPO }}" | |
if [[ -z "$RELEASE_REPO" ]]; then | |
RELEASE_REPO="PortMaster-Releases" | |
fi | |
echo "::set-output name=RELEASE_REPO::$RELEASE_REPO" | |
RELEASE_ORG="${{ secrets.RELEASE_ORG }}" | |
if [[ -z "$RELEASE_ORG" ]]; then | |
RELEASE_ORG="PortsMaster" | |
fi | |
echo "::set-output name=RELEASE_ORG::$RELEASE_ORG" | |
- uses: hmarr/debug-action@v2 | |
name: "debug: ${{github.event_name}}" | |
- uses: actions/checkout@v2 | |
- uses: robinraju/[email protected] | |
with: | |
repository: "${{ steps.env.outputs.LARGE_FILE_REPOSITORY}}" | |
tag: "${{steps.env.outputs.LARGE_FILE_TAG}}" | |
fileName: "*" | |
- name: Get release name for artifacts | |
id: date | |
run: | | |
echo "::set-output name=date::$(date +'%Y-%m-%d_%H%M')" | |
- name: Create PortMaster zip from PortMaster Folder | |
id: portmaster-zip | |
run: | | |
zip -9 -r ./PortMaster.zip PortMaster/ | |
- name: Create images zip from images Folder | |
id: images-zip | |
run: | | |
find images \( -iname '*.jpg' -o -iname '*.png' \) -exec touch -d '2021-01-01 00:00:00' {} \; | |
find images \( -iname '*.jpg' -o -iname '*.png' \) -exec chmod 644 {} \; | |
find images \( -iname '*.jpg' -o -iname '*.png' \) | sort | TZ=UTC zip -qX images.zip -@ | |
- name: Create md5 hashes | |
id: md5 | |
run: | | |
for file in *.zip *.squashfs; do | |
if [ ! -f "$file" ]; then | |
continue | |
fi | |
echo "file: $file" | |
md5sum "$file" | cut -f1 -d' ' > "$file.md5" | |
done | |
- name: "Publish release" | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: "${{steps.date.outputs.date}}" | |
allowUpdates: true | |
draft: false | |
prerelease: false | |
replacesArtifacts: false | |
omitNameDuringUpdate: true | |
artifacts: "ports.md, *.zip, version, *.squashfs, *.md5" | |
token: ${{ secrets.PORTMASTER_RELEASE_TOKEN }} | |
repo: ${{ steps.env.outputs.RELEASE_REPO}} | |
owner: ${{ steps.env.outputs.RELEASE_ORG}} | |
- name: Release Info | |
id: info | |
run: | | |
echo "Published release: ${{steps.date.outputs.date}} to: https://github.com/${{ steps.env.outputs.RELEASE_ORG}}/${{ steps.env.outputs.RELEASE_REPO}}" |