Merge branch 'master' into dependabot-docker-debian-bookworm-20240130… #7334
Workflow file for this run
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: metadata | |
on: | |
workflow_dispatch: | |
inputs: | |
DEBUG: | |
description: Enable debug logs for metadata | |
required: false | |
default: "no" | |
type: choice | |
options: | |
- "yes" | |
- "no" | |
push: | |
schedule: | |
- cron: "30 * * * *" | |
jobs: | |
metadata: | |
runs-on: ubuntu-latest | |
# exclude dependabot from running this workflow. | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
steps: | |
- name: Checkout project repo | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install python dependencies | |
run: | | |
sudo apt-get install -y \ | |
python3-gnupg \ | |
python3-requests \ | |
python3-bcrypt \ | |
python3-coloredlogs | |
- name: Generate metadata | |
run: ./scripts/generate-server-metadata --generate-list --output ./metadata | |
env: | |
PROTON_USERNAME: ${{ secrets.PROTON_USERNAME }} | |
PROTON_PASSWORD: ${{ secrets.PROTON_PASSWORD }} | |
DEBUG: ${{ inputs.DEBUG }} | |
- name: Generate bot token | |
uses: actions/create-github-app-token@v1 | |
id: bot-token | |
with: | |
app-id: ${{ vars.METADATA_BOT_APP_ID }} | |
repositories: ${{ vars.METADATA_REPO_NAME }} | |
owner: ${{ vars.METADATA_REPO_OWNER }} | |
private-key: ${{ secrets.METADATA_BOT_APP_PRIVATE_KEY }} | |
- name: Checkout metadata repo to protonwire-api-deploy | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ vars.METADATA_REPO }} | |
path: protonwire-api-deploy | |
token: ${{ steps.bot-token.outputs.token }} | |
persist-credentials: true | |
- name: Configure git and remove stale data | |
working-directory: protonwire-api-deploy | |
run: | | |
git config user.name ${{ vars.METADATA_BOT_GIT_USERNAME }} | |
git config user.email ${{ vars.METADATA_BOT_GIT_EMAIL }} | |
rm -rf ./v1/ | |
- name: Sync metadata | |
run: | | |
rsync \ | |
--archive \ | |
--human-readable \ | |
./metadata/ \ | |
${GITHUB_WORKSPACE}/protonwire-api-deploy/ | |
- name: Push Metadata (if on master) | |
working-directory: protonwire-api-deploy | |
if: github.ref == 'refs/heads/master' | |
run: | | |
git add --all | |
git commit -m "Updated at - $(date)" | |
git push -u origin master |