metadata #4091
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: | |
branches: | |
- "*" | |
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@v3 | |
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 | |
id: bot-token | |
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 | |
with: | |
repository: ${{ vars.METADATA_REPO }} | |
app_id: ${{ vars.METADATA_BOT_APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Checkout metadata repo to protonwire-api-deploy | |
uses: actions/checkout@v3 | |
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 |