81 lines
2.6 KiB
YAML
81 lines
2.6 KiB
YAML
name: Publish package
|
|
description: build and publish an Arch package
|
|
|
|
inputs:
|
|
username:
|
|
description: 'Gitea username'
|
|
required: true
|
|
token:
|
|
description: 'Gitea PAT'
|
|
required: true
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Get pkgbase versions
|
|
shell: bash
|
|
run: |
|
|
git reset --hard HEAD~1 && \
|
|
cp .artixlinux/pkgbase.yaml ./pkgbase.previous.yaml && \
|
|
git pull && \
|
|
git config --global user.name 'Guy Incognito' && \
|
|
git config --global user.email 'user@local' && \
|
|
git add ./pkgbase.previous.yaml && \
|
|
git commit -m "add previous pkgbase"
|
|
|
|
- name: Parse pkgbase
|
|
uses: https://git.sanin.dev/packages_test/pkgbase-yaml-parser@master
|
|
id: parsed
|
|
with:
|
|
previous: pkgbase.previous.yaml
|
|
current: .artixlinux/pkgbase.yaml
|
|
|
|
- name: Move package
|
|
uses: https://git.sanin.dev/packages_test/pkgbase-yaml-parser@master
|
|
if: ${{ steps.parsed.outputs.move == 'true' }}
|
|
with:
|
|
mode: move
|
|
parsed-data: ${{ steps.parsed.outputs.parsed-data }}
|
|
username: "${{ inputs.username }}"
|
|
token: ${{ inputs.token }}
|
|
|
|
- name: Create publish script
|
|
shell: bash
|
|
if: ${{ steps.parsed.outputs.build == 'true' }}
|
|
run: |
|
|
echo "#!/bin/bash
|
|
echo '📤️ Uploading package to ${{ gitea.server_url }} ...'
|
|
for f in ./*.tar.zst; do
|
|
[ -f \"$f\" ] || continue
|
|
curl -f --user \"\$username:\$token\" \
|
|
--upload-file \"$f\" \
|
|
'${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/arch/${{ steps.parsed.outputs.destination }}'
|
|
done
|
|
" > "./post-entrypoint.sh"
|
|
chmod +x "./post-entrypoint.sh"
|
|
git config --global user.name 'Guy Incognito'
|
|
git config --global user.email 'user@local'
|
|
git add "./post-entrypoint.sh"
|
|
git commit -m "persist publish script"
|
|
|
|
- name: Build package
|
|
uses: https://git.sanin.dev/packages_test/build-publish/@build
|
|
if: ${{ steps.parsed.outputs.build == 'true' }}
|
|
with:
|
|
username: "${{ inputs.username }}"
|
|
token: ${{ inputs.token }}
|
|
|
|
- name: Delete package
|
|
uses: https://git.sanin.dev/packages_test/pkgbase-yaml-parser@master
|
|
if: ${{ steps.parsed.outputs.delete == 'true' }}
|
|
with:
|
|
mode: delete
|
|
parsed-data: ${{ steps.parsed.outputs.parsed-data }}
|
|
username: "${{ inputs.username }}"
|
|
token: ${{ inputs.token }}
|