zotero/.forgejo/workflows/generate-tarball.yml

50 lines
1.9 KiB
YAML

on:
workflow_dispatch:
inputs:
ref_name:
description: 'Tag or commit'
required: true
type: string
jobs:
build-tarball:
name: Build tarball w/ submodules
runs-on: x86_64
container:
image: alpine:latest
env:
CI_PROJECT_NAME: zotero
steps:
- name: Environment setup
run: apk add nodejs git git-archive-all gzip
- name: Repo pull
uses: actions/checkout@v4
with:
fetch-depth: 500
ref: ${{ inputs.ref_name }}
- name: Package build
run: |
echo "building tarball for ${{ inputs.ref_name }}"
git-archive-all --force-submodules $CI_PROJECT_NAME-${{ inputs.ref_name }}.tar.gz
echo "Generating sha512sum"
sha512sum $CI_PROJECT_NAME-${{ inputs.ref_name }}.tar.gz > $CI_PROJECT_NAME-${{ inputs.ref_name }}.tar.gz.sha512sum
- name: Package upload
uses: forgejo/upload-artifact@v3
with:
name: tarball
path: zotero-${{ inputs.ref_name }}.*
upload-tarball:
name: Upload to generic repo
runs-on: x86_64
needs: [build-tarball]
container:
image: alpine:latest
steps:
- name: Environment setup
run: apk add nodejs curl
- name: Package download
uses: forgejo/download-artifact@v3
- name: Package deployment
run: |
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/zotero-${{ inputs.ref_name }}.tar.gz ${{ github.server_url }}/api/packages/mirrors/generic/zotero/${{ inputs.ref_name }}/zotero-${{ inputs.ref_name}}.tar.gz
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/zotero-${{ inputs.ref_name }}.tar.gz.sha512sum ${{ github.server_url }}/api/packages/mirrors/generic/zotero/${{ inputs.ref_name }}/zotero-${{ inputs.ref_name}}.tar.gz.sha512sum