piston/.github/workflows/package-push.yaml

80 lines
4.1 KiB
YAML

name: 'Package Pushed'
on:
push:
branches:
- master
- v3
paths:
- packages/**
workflow_dispatch:
jobs:
build-pkg:
name: Build package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to GitHub registry
uses: docker/login-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
- name: Get list of changed files
uses: lots0logs/gh-action-get-changed-files@2.1.4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build Packages
run: |
# PACKAGES=$(jq '.[]' -r ${HOME}/files*.json | awk -F/ '$1~/packages/ && $2 && $3{ print $2 "-" $3 }' | sort -u)
PACKAGES="MATL-22.5.0 bash-5.1.0 befunge93-0.2.0 bqn-1.0.0 brachylog-1.0.0 brainfuck-2.7.3 cjam-0.6.5 clojure-1.10.3 cobol-3.1.2 coffeescript-2.5.1 cow-1.0.0 crystal-0.36.1 dart-2.12.1 dash-0.5.11 deno-1.16.2 deno-1.7.5 dotnet-5.0.201 dragon-1.9.8 elixir-1.11.3 emacs-27.1.0 emojicode-1.0.2 erlang-23.0.0 file-0.0.1 forte-1.0.0 forth-0.7.3 freebasic-1.8.0 gawk-5.1.0 gcc-10.2.0 go-1.16.2 golfscript-1.0.0 groovy-3.0.7 haskell-9.0.1 husk-1.0.0 iverilog-11.0.0 japt-2.0.0 java-15.0.2 jelly-0.1.31 julia-1.5.4 julia-1.6.1 kotlin-1.4.31 lisp-2.1.2 llvm_ir-12.0.1 lolcode-0.11.2 lua-5.4.2 mono-6.12.0 nasm-2.15.5 nim-1.4.4 node-15.10.0 node-16.3.0 ocaml-4.12.0 octave-6.2.0 osabie-1.0.1 paradoc-0.6.0 pascal-3.2.0 perl-5.26.1 php-8.0.2 ponylang-0.39.0 prolog-8.2.4 pure-0.68.0 pwsh-7.1.4 pyth-1.0.0 python-2.7.18 python-3.10.0 python-3.10.0-alpha.7 python-3.5.10 python-3.9.1 python-3.9.4 racket-8.3.0 raku-6.100.0 retina-1.2.0 rockstar-1.0.0 rscript-4.1.1 ruby-2.5.1 ruby-3.0.1 rust-1.50.0 rust-1.56.1 rust-1.62.0 rust-1.63.0 rust-1.65.0 samarium-0.3.1 scala-3.0.0 smalltalk-3.2.3 sqlite3-3.36.0 swift-5.3.3 typescript-4.2.3 vlang-0.1.13 vyxal-2.4.1 yeethon-3.10.0 zig-0.7.1 zig-0.8.0 zig-0.9.1"
echo "Packages: $PACKAGES"
docker pull docker.pkg.github.com/endercheif/piston/repo-builder:latest
docker build -t repo-builder repo
docker run -v "${{ github.workspace }}:/piston" repo-builder --no-server $PACKAGES
ls -la packages
- name: Upload Packages
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: packages/*.pkg.tar.gz
tag: pkgs
overwrite: true
file_glob: true
create-index:
name: Create Index
runs-on: ubuntu-latest
needs: build-pkg
steps:
- name: 'Download all release assets'
run: curl -s https://api.github.com/repos/endercheif/piston/releases/latest | jq '.assets[].browser_download_url' -r | xargs -L 1 curl -sLO
- name: 'Generate index file'
run: |
echo "" > index
BASEURL=https://github.com/endercheif/piston/releases/download/pkgs/
for pkg in *.pkg.tar.gz
do
PKGFILE=$(basename $pkg)
PKGFILENAME=$(echo $PKGFILE | sed 's/\.pkg\.tar\.gz//g')
PKGNAME=$(echo $PKGFILENAME | grep -oP '^\K.+(?=-)')
PKGVERSION=$(echo $PKGFILENAME | grep -oP '^.+-\K.+')
PKGCHECKSUM=$(sha256sum $PKGFILE | awk '{print $1}')
echo "$PKGNAME,$PKGVERSION,$PKGCHECKSUM,$BASEURL$PKGFILE" >> index
echo "Adding package $PKGNAME-$PKGVERSION"
done
- name: Upload index
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: index
tag: pkgs
overwrite: true
file_glob: true