-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
162 additions
and
163 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
build_type: | ||
type: choice | ||
description: Set if the build target is a list or a package. | ||
options: | ||
- l | ||
- p | ||
required: true | ||
target_name: | ||
type: string | ||
description: The name of the package to test build. | ||
required: true | ||
workflow_call: | ||
inputs: | ||
build_type: | ||
type: string | ||
default: l | ||
target_name: | ||
type: string | ||
description: The package list to build (default is _all). | ||
default: _all | ||
outputs: | ||
artifact_name: | ||
description: "The name of the produced artifact bundle." | ||
value: ${{ jobs.build.outputs.artifact_name }} | ||
pull_request: | ||
types: [opened, synchronize] | ||
workflow_dispatch: | ||
inputs: | ||
build_type: | ||
type: choice | ||
description: Set if the build target is a list or a package. | ||
options: | ||
- l | ||
- p | ||
required: true | ||
target_name: | ||
type: string | ||
description: The name of the package to test build. | ||
required: true | ||
workflow_call: | ||
inputs: | ||
build_type: | ||
type: string | ||
default: l | ||
target_name: | ||
type: string | ||
description: The package list to build (default is _all). | ||
default: _all | ||
outputs: | ||
artifact_name: | ||
description: "The name of the produced artifact bundle." | ||
value: ${{ jobs.build.outputs.artifact_name }} | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
build: | ||
if: github.event_name != 'pull_request' || startsWith(github.head_ref, 'package/') | ||
runs-on: ubuntu-latest | ||
outputs: | ||
artifact_name: ${{ steps.output-artifact_name.outputs.ARTIFACT_NAME }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- if: github.event_name == 'pull_request' | ||
run: | | ||
echo "BUILD_TYPE=p" >> $GITHUB_ENV | ||
ref_name="${{ github.head_ref }}" | ||
echo "TARGET_NAME=${ref_name##*/}" >> $GITHUB_ENV | ||
- if: github.event_name != 'pull_request' | ||
run: | | ||
echo "BUILD_TYPE=${{ inputs.build_type }}" >> $GITHUB_ENV | ||
echo "TARGET_NAME=${{ inputs.target_name }}" >> $GITHUB_ENV | ||
- run: | | ||
out_dir=$(mktemp -d) | ||
chmod 777 $out_dir | ||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
docker run --rm --pull always -t -v $(pwd)/packages:/tmp/workdir:ro -w /tmp/workdir -v $(pwd)/build_orders:/tmp/build_orders:ro -v $out_dir:/tmp/output:rw -v $(pwd)/docker/makepkg.conf:/etc/makepkg.conf:ro -v $(pwd)/docker/build_package.sh:/build_package.sh:ro ghcr.io/mortyr45/archlinux:devtools bash /build_package.sh -${{ env.BUILD_TYPE }} ${{ env.TARGET_NAME }} | ||
echo "OUT_DIR=$out_dir" >> $GITHUB_ENV | ||
echo "ARTIFACT_NAME=built_packages" >> $GITHUB_ENV | ||
- uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
fingerprint: ${{ vars.GPG_FINGERPRINT }} | ||
gpg_private_key: ${{ secrets.GPG_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
trust_level: 4 | ||
- run: for file in $(ls ${{ env.OUT_DIR }}/); do gpg --detach-sign --local-user ${{ vars.GPG_FINGERPRINT }} --passphrase ${{ secrets.GPG_PASSPHRASE }} ${{ env.OUT_DIR }}/$file ; done | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.ARTIFACT_NAME }} | ||
path: "${{ env.OUT_DIR }}/" | ||
if-no-files-found: error | ||
- id: output-artifact_name | ||
run: echo "ARTIFACT_NAME=${{ env.ARTIFACT_NAME }}" >> $GITHUB_OUTPUT | ||
build: | ||
if: github.event_name != 'pull_request' || startsWith(github.head_ref, 'package/') | ||
runs-on: ubuntu-latest | ||
outputs: | ||
artifact_name: ${{ steps.output-artifact_name.outputs.ARTIFACT_NAME }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- if: github.event_name == 'pull_request' | ||
run: | | ||
echo "BUILD_TYPE=p" >> $GITHUB_ENV | ||
ref_name="${{ github.head_ref }}" | ||
echo "TARGET_NAME=${ref_name##*/}" >> $GITHUB_ENV | ||
- if: github.event_name != 'pull_request' | ||
run: | | ||
echo "BUILD_TYPE=${{ inputs.build_type }}" >> $GITHUB_ENV | ||
echo "TARGET_NAME=${{ inputs.target_name }}" >> $GITHUB_ENV | ||
- run: | | ||
out_dir=$(mktemp -d) | ||
chmod 777 $out_dir | ||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
docker run --rm --pull always -t -v $(pwd)/packages:/tmp/workdir:ro -w /tmp/workdir -v $(pwd)/build_orders:/tmp/build_orders:ro -v $out_dir:/tmp/output:rw -v $(pwd)/docker/makepkg.conf:/etc/makepkg.conf:ro -v $(pwd)/docker/build_package.sh:/build_package.sh:ro ghcr.io/mortyr45/archlinux:devtools bash /build_package.sh -${{ env.BUILD_TYPE }} ${{ env.TARGET_NAME }} | ||
echo "OUT_DIR=$out_dir" >> $GITHUB_ENV | ||
echo "ARTIFACT_NAME=built_packages" >> $GITHUB_ENV | ||
- uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
fingerprint: ${{ vars.GPG_FINGERPRINT }} | ||
gpg_private_key: ${{ secrets.GPG_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
trust_level: 4 | ||
- run: for file in $(ls ${{ env.OUT_DIR }}/); do gpg --detach-sign --local-user ${{ vars.GPG_FINGERPRINT }} --passphrase ${{ secrets.GPG_PASSPHRASE }} ${{ env.OUT_DIR }}/$file ; done | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.ARTIFACT_NAME }} | ||
path: "${{ env.OUT_DIR }}/" | ||
if-no-files-found: error | ||
- id: output-artifact_name | ||
run: echo "ARTIFACT_NAME=${{ env.ARTIFACT_NAME }}" >> $GITHUB_OUTPUT |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
run-name: Build repository ${{ inputs.repository_name }} with list ${{ inputs.package_list }}. | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
package_list: | ||
type: string | ||
default: _all | ||
repository_name: | ||
type: string | ||
default: kovacsmiki | ||
workflow_dispatch: | ||
inputs: | ||
package_list: | ||
type: string | ||
default: _all | ||
repository_name: | ||
type: string | ||
default: kovacsmiki | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
build-package-list: | ||
uses: ./.github/workflows/build.yml | ||
build-package-list: | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
target_name: ${{ inputs.package_list }} | ||
secrets: inherit | ||
build-repository: | ||
runs-on: ubuntu-latest | ||
needs: build-package-list | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
target_name: ${{ inputs.package_list }} | ||
secrets: inherit | ||
build-repository: | ||
runs-on: ubuntu-latest | ||
needs: build-package-list | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ needs.build-package-list.outputs.artifact_name }} | ||
path: ./package_files | ||
- run: chmod 777 ./package_files | ||
- uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
fingerprint: ${{ vars.GPG_FINGERPRINT }} | ||
gpg_private_key: ${{ secrets.GPG_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
trust_level: 4 | ||
- run: | | ||
echo "repo-add /data/${{ inputs.repository_name }}.db.tar.zst /data/*.pkg.tar.zst" > script.sh | ||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
docker run --rm --pull always -t -v $(pwd)/package_files:/data:rw -v $(pwd)/script.sh:/script.sh ghcr.io/mortyr45/archlinux:devtools bash /script.sh | ||
- run: | | ||
cd ./package_files | ||
rm ${{ inputs.repository_name }}.{db,files} | ||
mv ${{ inputs.repository_name }}.db.tar.zst ${{ inputs.repository_name }}.db | ||
mv ${{ inputs.repository_name }}.files.tar.zst ${{ inputs.repository_name }}.files | ||
gpg --detach-sign --local-user ${{ vars.GPG_FINGERPRINT }} --passphrase ${{ secrets.GPG_PASSPHRASE }} ${{ inputs.repository_name }}.db | ||
gpg --detach-sign --local-user ${{ vars.GPG_FINGERPRINT }} --passphrase ${{ secrets.GPG_PASSPHRASE }} ${{ inputs.repository_name }}.files | ||
cd - | ||
- uses: Hs1r1us/Release-AIO@v2.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.sha }} | ||
release_name: ${{ github.sha }} | ||
asset_files: ./package_files | ||
draft: true | ||
name: ${{ needs.build-package-list.outputs.artifact_name }} | ||
path: ./package_files | ||
- run: chmod 777 ./package_files | ||
- uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
fingerprint: ${{ vars.GPG_FINGERPRINT }} | ||
gpg_private_key: ${{ secrets.GPG_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
trust_level: 4 | ||
- run: | | ||
echo "repo-add /data/${{ inputs.repository_name }}.db.tar.zst /data/*.pkg.tar.zst" > script.sh | ||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | ||
docker run --rm --pull always -t -v $(pwd)/package_files:/data:rw -v $(pwd)/script.sh:/script.sh ghcr.io/mortyr45/archlinux:devtools bash /script.sh | ||
- run: | | ||
cd ./package_files | ||
rm ${{ inputs.repository_name }}.{db,files} | ||
mv ${{ inputs.repository_name }}.db.tar.zst ${{ inputs.repository_name }}.db | ||
mv ${{ inputs.repository_name }}.files.tar.zst ${{ inputs.repository_name }}.files | ||
gpg --detach-sign --local-user ${{ vars.GPG_FINGERPRINT }} --passphrase ${{ secrets.GPG_PASSPHRASE }} ${{ inputs.repository_name }}.db | ||
gpg --detach-sign --local-user ${{ vars.GPG_FINGERPRINT }} --passphrase ${{ secrets.GPG_PASSPHRASE }} ${{ inputs.repository_name }}.files | ||
cd - | ||
- uses: Hs1r1us/Release-AIO@v2.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.sha }} | ||
release_name: ${{ github.sha }} | ||
asset_files: ./package_files | ||
draft: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
package_name: | ||
type: string | ||
required: true | ||
workflow_dispatch: | ||
inputs: | ||
package_name: | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
create_pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: | | ||
wget https://aur.archlinux.org/cgit/aur.git/snapshot/${{ inputs.package_name }}.tar.gz | ||
ls | ||
tar --overwrite -xf ${{ inputs.package_name }}.tar.gz -C packages/${{ inputs.package_name }} --strip-components=1 | ||
cd packages/${{ inputs.package_name }} | ||
pkgver=$(cat .SRCINFO | grep pkgver | cut -d' ' -f 3) | ||
echo "PKGVER=$pkgver" >> $GITHUB_ENV | ||
pkgrel=$(cat .SRCINFO | grep pkgrel | cut -d' ' -f 3) | ||
echo "PKGREL=$pkgrel" >> $GITHUB_ENV | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.REPO_TOKEN }} | ||
add-paths: | | ||
packages/* | ||
commit-message: "${{ inputs.package_name }} v${{ env.PKGVER }}-${{ env.PKGREL }}" | ||
branch: "package/${{ inputs.package_name }}" | ||
base: master | ||
title: "${{ inputs.package_name }} v${{ env.PKGVER }}-${{ env.PKGREL }}" | ||
body: "" | ||
assignees: mortyr45 | ||
create_pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: | | ||
wget https://aur.archlinux.org/cgit/aur.git/snapshot/${{ inputs.package_name }}.tar.gz | ||
ls | ||
tar --overwrite -xf ${{ inputs.package_name }}.tar.gz -C packages/${{ inputs.package_name }} --strip-components=1 | ||
cd packages/${{ inputs.package_name }} | ||
pkgver=$(cat .SRCINFO | grep pkgver | cut -d' ' -f 3) | ||
echo "PKGVER=$pkgver" >> $GITHUB_ENV | ||
pkgrel=$(cat .SRCINFO | grep pkgrel | cut -d' ' -f 3) | ||
echo "PKGREL=$pkgrel" >> $GITHUB_ENV | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.REPO_TOKEN }} | ||
add-paths: | | ||
packages/* | ||
commit-message: "${{ inputs.package_name }} v${{ env.PKGVER }}-${{ env.PKGREL }}" | ||
branch: "package/${{ inputs.package_name }}" | ||
base: master | ||
title: "${{ inputs.package_name }} v${{ env.PKGVER }}-${{ env.PKGREL }}" | ||
body: "" | ||
assignees: mortyr45 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
on: | ||
release: | ||
types: | ||
- published | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
update_url: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
CLOUDFLARE_API_TOKEN=${{ secrets.CF_API_TOKEN }} | ||
RELEASE_ID=${{ github.event.release.id }} | ||
RELEASE_NAME=${{ github.event.release.name }} | ||
ZONE_ID=${{ secrets.CF_ZONE_ID }} | ||
PAGE_RULE_ID=${{ secrets.CF_PAGE_RULE_ID }} | ||
NEW_URL_PATTERN="https://pacman.kovacsmiki.com/x86_64/*" | ||
NEW_SETTINGS='{"forwarding_url": {"url": "https://github.com/mortyr45/pacman-repository/releases/download/'"$RELEASE_NAME"'/$1", "status_code": 301}}' | ||
curl -X PUT "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/pagerules/$PAGE_RULE_ID" \ | ||
-H "X-Auth-Key: $CLOUDFLARE_API_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
--data '{"targets": [{"target": "url", "constraint": {"operator": "matches", "value": "'"$NEW_URL_PATTERN"'"}}], "actions": ['"$NEW_SETTINGS"'], "priority": 1, "status": "active"}' | ||
update_url: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
CLOUDFLARE_API_TOKEN=${{ secrets.CF_API_TOKEN }} | ||
RELEASE_ID=${{ github.event.release.id }} | ||
RELEASE_NAME=${{ github.event.release.name }} | ||
ZONE_ID=${{ secrets.CF_ZONE_ID }} | ||
PAGE_RULE_ID=${{ secrets.CF_PAGE_RULE_ID }} | ||
NEW_URL_PATTERN="https://pacman.kovacsmiki.com/x86_64/*" | ||
NEW_SETTINGS='{"forwarding_url": {"url": "https://github.com/mortyr45/pacman-repository/releases/download/'"$RELEASE_NAME"'/$1", "status_code": 301}}' | ||
curl -X PUT "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/pagerules/$PAGE_RULE_ID" \ | ||
-H "X-Auth-Key: $CLOUDFLARE_API_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
--data '{"targets": [{"target": "url", "constraint": {"operator": "matches", "value": "'"$NEW_URL_PATTERN"'"}}], "actions": ['"$NEW_SETTINGS"'], "priority": 1, "status": "active"}' |