2021-03-15 06:29:40 +01:00
|
|
|
name: 'Package Pushed'
|
|
|
|
|
|
|
|
on:
|
2021-10-08 15:16:57 +02:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- v3
|
|
|
|
paths:
|
|
|
|
- packages/**
|
2023-02-15 04:38:25 +01:00
|
|
|
workflow_dispatch:
|
2021-03-15 06:29:40 +01:00
|
|
|
|
|
|
|
jobs:
|
2021-10-08 15:16:57 +02:00
|
|
|
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 }}
|
2021-03-15 06:29:40 +01:00
|
|
|
|
2021-10-08 15:16:57 +02:00
|
|
|
- name: Build Packages
|
|
|
|
run: |
|
2023-02-15 04:52:40 +01:00
|
|
|
# PACKAGES=$(jq '.[]' -r ${HOME}/files*.json | awk -F/ '$1~/packages/ && $2 && $3{ print $2 "-" $3 }' | sort -u)
|
|
|
|
PACKAGES="CONTRIBUTING.MD MATL Makefile README.MD bash befunge93 bqn brachylog brainfuck cjam clojure cobol coffeescript cow crystal dart dash deno dotnet dragon elixir emacs emojicode erlang file forte forth freebasic gawk gcc go golfscript groovy haskell husk init iverilog japt java jelly julia kotlin lisp llvm_ir lolcode lua mono nasm nim node ocaml octave osabie paradoc pascal perl php ponylang prolog pure pwsh pyth python racket raku retina rockstar rscript ruby rust samarium scala smalltalk sqlite3 swift test.sh typescript vlang vyxal yeethon zig"
|
2021-10-08 15:16:57 +02:00
|
|
|
echo "Packages: $PACKAGES"
|
2023-02-15 04:12:42 +01:00
|
|
|
docker pull docker.pkg.github.com/endercheif/piston/repo-builder:latest
|
2021-10-08 15:16:57 +02:00
|
|
|
docker build -t repo-builder repo
|
|
|
|
docker run -v "${{ github.workspace }}:/piston" repo-builder --no-server $PACKAGES
|
|
|
|
ls -la packages
|
2021-03-15 06:29:40 +01:00
|
|
|
|
2021-10-08 15:16:57 +02:00
|
|
|
- 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'
|
2023-02-15 04:12:42 +01:00
|
|
|
run: curl -s https://api.github.com/repos/endercheif/piston/releases/latest | jq '.assets[].browser_download_url' -r | xargs -L 1 curl -sLO
|
2021-10-08 15:16:57 +02:00
|
|
|
- name: 'Generate index file'
|
|
|
|
run: |
|
|
|
|
echo "" > index
|
2023-02-15 04:12:42 +01:00
|
|
|
BASEURL=https://github.com/endercheif/piston/releases/download/pkgs/
|
2021-10-08 15:16:57 +02:00
|
|
|
for pkg in *.pkg.tar.gz
|
|
|
|
do
|
|
|
|
PKGFILE=$(basename $pkg)
|
|
|
|
PKGFILENAME=$(echo $PKGFILE | sed 's/\.pkg\.tar\.gz//g')
|
2021-03-15 07:18:01 +01:00
|
|
|
|
2021-10-08 15:16:57 +02:00
|
|
|
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
|