Merge pull request 'CI: Added ui-assets workflow.' (#309) from Qubasa-Qubasa-main into main
This commit is contained in:
@@ -5,6 +5,7 @@ on:
|
|||||||
branches: main
|
branches: main
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
if: ${{ github.actor != 'clan-bot' }}
|
||||||
runs-on: nix
|
runs-on: nix
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ on:
|
|||||||
branches: main
|
branches: main
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
if: ${{ github.actor != 'clan-bot' }}
|
||||||
runs-on: nix
|
runs-on: nix
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
name: assets
|
name: assets1
|
||||||
# on:
|
on:
|
||||||
# push:
|
push:
|
||||||
# branches:
|
branches:
|
||||||
# - main
|
- main
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
if: ${{ github.actor != 'clan-bot' }}
|
||||||
runs-on: nix
|
runs-on: nix
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -29,9 +30,33 @@ jobs:
|
|||||||
|
|
||||||
# git push if we have a diff
|
# git push if we have a diff
|
||||||
if [[ -n $(git diff) ]]; then
|
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.email "clan-bot@clan.lol"
|
||||||
git config --global user.name "clan-bot"
|
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"
|
git commit -am "update ui-assets.nix"
|
||||||
|
|
||||||
echo "Current branch: $GITHUB_REF_NAME"
|
echo "Current branch: $GITHUB_REF_NAME"
|
||||||
git push origin HEAD:$GITHUB_REF_NAME
|
git push origin HEAD:$GITHUB_REF_NAME
|
||||||
fi
|
fi
|
||||||
@@ -40,4 +65,4 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
MODIFIED_FILES: ${{ steps.changed-files.outputs.modified_files }}
|
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
|
# GITEA_TOKEN
|
||||||
if [[ -z "${GITEA_TOKEN:-}" ]]; then
|
if [[ -z "${GITEA_TOKEN:-}" ]]; then
|
||||||
echo "GITEA_TOKEN is not set"
|
echo "GITEA_TOKEN is not set"
|
||||||
|
echo "Go to https://git.clan.lol/user/settings/applications and generate a token"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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"
|
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")
|
TEST_URL=$(nix-prefetch-url --unpack "$url")
|
||||||
if [[ $TEST_URL != "$NAR_HASH" ]]; then
|
if [[ $TEST_URL != "$NAR_HASH" ]]; then
|
||||||
@@ -40,4 +43,3 @@ fetchzip {
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user