Add package to repository #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Add package to repository" | |
on: | |
repository_dispatch: | |
types: [add-package] | |
workflow_dispatch: | |
inputs: | |
urls: | |
description: "URLs of the packages to add" | |
required: true | |
dist: | |
description: "Distribution to add the packages to" | |
required: true | |
component: | |
description: "Component to add the packages to" | |
required: true | |
jobs: | |
add-package: | |
name: "Add package" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
path: checkout | |
- name: Fetch package | |
id: fetch | |
run: | | |
if [[ "${{ github.event_name }}" = "repository_dispatch" && "${{ github.event.action }}" = "add-package" ]]; then | |
URLS="${{ github.event.client_payload.urls }}" | |
DIST="${{ github.event.client_payload.dist }}" | |
COMPONENT="${{ github.event.client_payload.component }}" | |
else | |
URLS="${{ github.event.inputs.urls }}" | |
DIST="${{ github.event.inputs.dist }}" | |
COMPONENT="${{ github.event.inputs.component }}" | |
fi | |
echo "URLs: $URLS" | |
echo "DIST: $DIST" | |
echo "COMPONENT: $COMPONENT" | |
# download packages | |
for u in $URLS ; do | |
curl -LOJ $u | |
done | |
# figure out file and package name | |
debs=(*.deb) | |
name=$(echo ${debs[0]} | cut -d_ -f1) | |
# copy package to repo | |
target=checkout/pool/$DIST/$COMPONENT/$name | |
mkdir -p $target && mv ${debs[@]} $target | |
echo "DEBS=${debs[*]}" >> $GITHUB_ENV | |
echo "DIST=$DIST" >> $GITHUB_ENV | |
echo "COMPONENT=$COMPONENT" >> $GITHUB_ENV | |
echo "PACKAGE=$name" >> $GITHUB_ENV | |
- name: Create PR | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: checkout | |
commit-message: "Add package(s) ${{ env.DEBS }} for ${{ env.DIST }}/${{ env.COMPONENT }}" | |
committer: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>" | |
author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>" | |
branch: "add-package/${{ env.DIST }}-${{ env.COMPONENT }}-${{ env.PACKAGE}}" | |
title: "Add package(s) ${{ env.DEBS }} for ${{ env.DIST }}/${{ env.COMPONENT }}" | |
body: | | |
This PR adds the package(s) ${{ env.DEBS }} for ${{ env.DIST }}/${{ env.COMPONENT }} to the apt repository. | |
Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request) | |
delete-branch: true | |