Merge pull request 'CI: Added ui-assets workflow.' (#309) from Qubasa-Qubasa-main into main
This commit is contained in:
commit
9cff6a39e8
@ -5,6 +5,7 @@ on:
|
||||
branches: main
|
||||
jobs:
|
||||
test:
|
||||
if: ${{ github.actor != 'clan-bot' }}
|
||||
runs-on: nix
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -5,6 +5,7 @@ on:
|
||||
branches: main
|
||||
jobs:
|
||||
test:
|
||||
if: ${{ github.actor != 'clan-bot' }}
|
||||
runs-on: nix
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -1,10 +1,11 @@
|
||||
name: assets
|
||||
# on:
|
||||
# push:
|
||||
# branches:
|
||||
# - main
|
||||
name: assets1
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
test:
|
||||
if: ${{ github.actor != 'clan-bot' }}
|
||||
runs-on: nix
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@ -29,9 +30,33 @@ jobs:
|
||||
|
||||
# git push if we have a diff
|
||||
if [[ -n $(git diff) ]]; then
|
||||
|
||||
DEPS=$(nix shell --inputs-from '.#' "nixpkgs#coreutils-full" -c bash -c "echo \$PATH")
|
||||
export PATH=$PATH:$DEPS
|
||||
|
||||
# Setup git config
|
||||
git config --global user.email "clan-bot@clan.lol"
|
||||
git config --global user.name "clan-bot"
|
||||
|
||||
################################################
|
||||
# #
|
||||
# WARNING: SECRETS ARE BEING PROCESSED HERE. #
|
||||
# !DO NOT LOG THIS! #
|
||||
# #
|
||||
################################################
|
||||
set +x
|
||||
AUTH_TOKEN=$(echo -n "x-access-token:$GITEA_TOKEN" | base64)
|
||||
git config http."$GITHUB_SERVER_URL/".extraheader "AUTHORIZATION: basic $AUTH_TOKEN"
|
||||
set -x
|
||||
################################################
|
||||
# #
|
||||
# END OF SECRETS AREA #
|
||||
# #
|
||||
################################################
|
||||
|
||||
# Commit and push
|
||||
git commit -am "update ui-assets.nix"
|
||||
|
||||
echo "Current branch: $GITHUB_REF_NAME"
|
||||
git push origin HEAD:$GITHUB_REF_NAME
|
||||
fi
|
||||
@ -40,4 +65,4 @@ jobs:
|
||||
fi
|
||||
env:
|
||||
MODIFIED_FILES: ${{ steps.changed-files.outputs.modified_files }}
|
||||
GITEA_TOKEN: ${{ secrets.TEA_TOKEN_QUBASA }}
|
||||
GITEA_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}
|
||||
|
@ -4,6 +4,7 @@ set -xeuo pipefail
|
||||
# GITEA_TOKEN
|
||||
if [[ -z "${GITEA_TOKEN:-}" ]]; then
|
||||
echo "GITEA_TOKEN is not set"
|
||||
echo "Go to https://git.clan.lol/user/settings/applications and generate a token"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -23,7 +24,9 @@ NAR_HASH=$(nix-prefetch-url --unpack file://<(cat "$tmpdir/assets.tar.gz"))
|
||||
|
||||
|
||||
url="https://git.clan.lol/api/packages/clan/generic/ui/$NAR_HASH/assets.tar.gz"
|
||||
curl -v --upload-file "$tmpdir/assets.tar.gz" -X PUT "$url?token=$GITEA_TOKEN"
|
||||
set +x
|
||||
curl --upload-file "$tmpdir/assets.tar.gz" -X PUT "$url?token=$GITEA_TOKEN"
|
||||
set -x
|
||||
|
||||
TEST_URL=$(nix-prefetch-url --unpack "$url")
|
||||
if [[ $TEST_URL != "$NAR_HASH" ]]; then
|
||||
@ -40,4 +43,3 @@ fetchzip {
|
||||
}
|
||||
EOF
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user