chore(deps): update actions/setup-python action to v5 (#42) #20
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: Deploy challenges | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "**/challenge.yml" | |
workflow_dispatch: | |
filter: | |
type: string | |
description: Glob pattern for target challenges | |
required: true | |
default: '**/challenge.yml' | |
jobs: | |
get-chals: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
outputs: | |
challenges: ${{ github.event_name == 'workflow_dispatch' && inputs.filter || steps.changed-files.outputs.all_changed_and_modified_files }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/[email protected] | |
with: | |
files: "**/challenge.yml" | |
deploy: | |
needs: get-chals | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
# https://github.com/actions/checkout/issues/165#issuecomment-1639209867 | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Create LFS file list | |
run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/[email protected] | |
with: | |
path: .git/lfs/objects | |
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} | |
restore-keys: | | |
${{ runner.os }}-lfs- | |
- run: git lfs pull | |
- uses: actions/[email protected] | |
with: | |
python-version: 3.x | |
- name: Setup ctfcli | |
run: pip install ctfcli==0.1.0 | |
- name: Load CTFd credentials | |
run: | | |
mkdir .ctf | |
cat <<EOF > .ctf/config | |
[config] | |
url = https://${{ vars.CTFD_DOMAIN }} | |
access_token = ${{ secrets.CTFD_TOKEN }} | |
[cookies] | |
site_password = ${{ secrets.CTFD_SITE_PASSWORD }} | |
[challenges] | |
EOF | |
- name: Deploy challenges | |
run: | | |
shopt -s globstar | |
for chal in ${{ needs.get-chals.outputs.challenges }}; do | |
ctf challenge install $chal --force | |
done |