This repository has been archived on 2025-11-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
build-publish/action.yml
2025-11-07 17:57:08 -05:00

82 lines
2.7 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
- name: Parse pkgbase
uses: https://git.sanin.dev/packages_test/pkgbase-yaml-parser@4a8498f97548b099c71519fb39e839bcd96294d2
id: parsed
with:
previous: ${{ gitea.server_url }}/${{ gitea.repository }}/raw/tag/latest/.artixlinux/pkgbase.yaml
current: .artixlinux/pkgbase.yaml
- name: Move package
uses: https://git.sanin.dev/packages_test/pkgbase-yaml-parser@4a8498f97548b099c71519fb39e839bcd96294d2
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" && \
cat "./post-entrypoint.sh"
- 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: Revert publish script
shell: bash
if: ${{ steps.parsed.outputs.build == 'true' }}
run: git reset --hard HEAD~1
- name: Delete package
uses: https://git.sanin.dev/packages_test/pkgbase-yaml-parser@4a8498f97548b099c71519fb39e839bcd96294d2
if: ${{ steps.parsed.outputs.delete == 'true' }}
with:
mode: delete
parsed-data: ${{ steps.parsed.outputs.parsed-data }}
username: "${{ inputs.username }}"
token: ${{ inputs.token }}
- name: Update latest tag
shell: bash
run: |
git config user.name "Gitea CI"
git config user.email "ci@gitea.local"
git tag -f latest
git push origin -f latest