Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes via gt update #151

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 51 additions & 9 deletions .github/workflows/gt-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under European Union Public License 1.2
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v0.13.3
# Version: v0.14.0
#
###################################
name: "gt update"
Expand All @@ -14,9 +14,12 @@ on:
workflow_dispatch:

jobs:
Update:
determine_remotes:
name: Determine Remotes
runs-on: ubuntu-latest
if: github.repository_owner == 'tegonal'
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Import gpg key(s) defined in vars.PUBLIC_GPG_KEYS_WE_TRUST and secrets.PUBLIC_GPG_KEYS_WE_TRUST
run: |
Expand All @@ -25,7 +28,45 @@ jobs:
false || gpg --import - <<< "${{ secrets.PUBLIC_GPG_KEYS_WE_TRUST }}" && success=true \
|| (echo "could not import GPG keys via secrets.PUBLIC_GPG_KEYS_WE_TRUST -- maybe it's not defined"; exit 1) && \
false || "${success:-false}" && echo "was able to import GPGs either via vars or secrets (or via both -- see above)"
- name: Install gt
run: |
set -e
# see install.doc.sh in https://github.com/tegonal/gt, MODIFY THERE NOT HERE (please report bugs)
currentDir=$(pwd) && \
tmpDir=$(mktemp -d -t gt-download-install-XXXXXXXXXX) && cd "$tmpDir" && \
wget "https://raw.githubusercontent.com/tegonal/gt/main/.gt/signing-key.public.asc" && \
wget "https://raw.githubusercontent.com/tegonal/gt/main/.gt/signing-key.public.asc.sig" && \
gpg --verify ./signing-key.public.asc.sig ./signing-key.public.asc && \
echo "public key trusted" && \
mkdir ./gpg && \
gpg --homedir ./gpg --import ./signing-key.public.asc && \
wget "https://raw.githubusercontent.com/tegonal/gt/v0.14.0/install.sh" && \
wget "https://raw.githubusercontent.com/tegonal/gt/v0.14.0/install.sh.sig" && \
gpg --homedir ./gpg --verify ./install.sh.sig ./install.sh && \
chmod +x ./install.sh && \
echo "verification successful" || (echo "!! verification failed, don't continue !!"; exit 1) && \
./install.sh && result=true || (echo "installation failed"; exit 1) && \
false || cd "$currentDir" && rm -r "$tmpDir" && "${result:-false}"
# end install.doc.sh
- uses: actions/checkout@v4
- id: set-matrix
run: |
(readarray -t REMOTES; IFS=','; echo "matrix={ 'remote': [ ${REMOTES[*]} ] }" >> "$GITHUB_OUTPUT") < <( gt remote list | sed -E "s/(.*)/'\1'/")
Update:
needs: determine_remotes
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.determine_remotes.outputs.matrix) }}
name: 'Update remote ${{ matrix.remote }}'
steps:
- name: Import gpg key(s) defined in vars.PUBLIC_GPG_KEYS_WE_TRUST and secrets.PUBLIC_GPG_KEYS_WE_TRUST
run: |
gpg --import - <<< "${{ vars.PUBLIC_GPG_KEYS_WE_TRUST }}" && success=true \
|| (echo "could not import GPG keys via vars.PUBLIC_GPG_KEYS_WE_TRUST -- maybe it's not defined"; exit 1) && \
false || gpg --import - <<< "${{ secrets.PUBLIC_GPG_KEYS_WE_TRUST }}" && success=true \
|| (echo "could not import GPG keys via secrets.PUBLIC_GPG_KEYS_WE_TRUST -- maybe it's not defined"; exit 1) && \
false || "${success:-false}" && echo "was able to import GPGs either via vars or secrets (or via both -- see above)"
- name: Install gt
run: |
set -e
Expand All @@ -38,28 +79,29 @@ jobs:
echo "public key trusted" && \
mkdir ./gpg && \
gpg --homedir ./gpg --import ./signing-key.public.asc && \
wget "https://raw.githubusercontent.com/tegonal/gt/v0.13.3/install.sh" && \
wget "https://raw.githubusercontent.com/tegonal/gt/v0.13.3/install.sh.sig" && \
wget "https://raw.githubusercontent.com/tegonal/gt/v0.14.0/install.sh" && \
wget "https://raw.githubusercontent.com/tegonal/gt/v0.14.0/install.sh.sig" && \
gpg --homedir ./gpg --verify ./install.sh.sig ./install.sh && \
chmod +x ./install.sh && \
echo "verification successful" || (echo "!! verification failed, don't continue !!"; exit 1) && \
./install.sh && result=true || (echo "installation failed"; exit 1) && \
false || cd "$currentDir" && rm -r "$tmpDir" && "${result:-false}"
# end install.doc.sh
- uses: actions/checkout@v4
- name: reset gpg keys
run: gt reset --gpg-only true
run: gt reset --gpg-only true -r "${{ matrix.remote }}"
- name: gt update
run: gt update
run: gt update -r "${{ matrix.remote }}"
- name: git status
run: git status
- name: Create pull request if necessary
uses: peter-evans/create-pull-request@v5
with:
branch: gt/update
branch: 'gt/update/${{ matrix.remote }}'
base: main
title: Changes via gt update
title: 'Changes via gt update for remote ${{ matrix.remote }}'
commit-message: update files pulled via gt
body: "following the changes after running `gt update` (among other things)"
body: "following the changes after running `gt update -r \"${{ matrix.remote }}\"` (among other things)"
delete-branch: true
token: ${{ secrets.AUTO_PR_TOKEN }}
push-to-fork: ${{ secrets.AUTO_PR_FORK_NAME }}
2 changes: 1 addition & 1 deletion .gt/remotes/gt/pulled.tsv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#@ Version: 1.0.0
tag file relativeTarget sha512
v0.13.3 .github/workflows/gt-update.yml ../.github/workflows/gt-update.yml ab953ea436ff4c311d7cfa568a565c3bbb6785993d8e2daee1398bb077641c21e3a3b94ac4646cab7017c7edc4acec3e404292b1d8d1b4eb5f97a47d34368f63
v0.14.0 .github/workflows/gt-update.yml ../.github/workflows/gt-update.yml c54eabfe963874762942d742ac0cab9213f6579ef932e6e40ba890d5317199b19c57541e465aa291bd702725bdc8c3f49ddb01c4bc95a8fff11ff6e044ee6a84