|
| 1 | +name: Watch upstream dnscrypt-proxy releases (update testing) |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 9 * * *" # once per day at 09:00 UTC |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + pull-requests: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + bump: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout testing branch |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + ref: testing |
| 21 | + |
| 22 | + - name: Get latest upstream release version |
| 23 | + id: upstream |
| 24 | + shell: bash |
| 25 | + run: | |
| 26 | + LATEST="$(curl -fsSL https://api.github.com/repos/DNSCrypt/dnscrypt-proxy/releases/latest \ |
| 27 | + | python -c "import sys,json; print(json.load(sys.stdin)['tag_name'].lstrip('v'))")" |
| 28 | +
|
| 29 | + echo "Latest upstream version: $LATEST" |
| 30 | + echo "latest=$LATEST" >> "$GITHUB_OUTPUT" |
| 31 | +
|
| 32 | + - name: Update DNSCRYPT_PROXY_VERSION if needed |
| 33 | + id: update |
| 34 | + shell: bash |
| 35 | + run: | |
| 36 | + CURRENT="$(cat DNSCRYPT_PROXY_VERSION 2>/dev/null || true)" |
| 37 | + LATEST="${{ steps.upstream.outputs.latest }}" |
| 38 | +
|
| 39 | + echo "Current version in repo: $CURRENT" |
| 40 | + echo "Latest upstream version: $LATEST" |
| 41 | +
|
| 42 | + # Nothing to do if empty or unchanged |
| 43 | + if [ -z "$LATEST" ] || [ "$CURRENT" = "$LATEST" ]; then |
| 44 | + echo "No update needed." |
| 45 | + echo "changed=false" >> "$GITHUB_OUTPUT" |
| 46 | + exit 0 |
| 47 | + fi |
| 48 | +
|
| 49 | + echo "Updating DNSCRYPT_PROXY_VERSION to $LATEST" |
| 50 | + echo "$LATEST" > DNSCRYPT_PROXY_VERSION |
| 51 | + echo "changed=true" >> "$GITHUB_OUTPUT" |
| 52 | +
|
| 53 | + - name: Create PR into testing |
| 54 | + if: steps.update.outputs.changed == 'true' |
| 55 | + uses: peter-evans/create-pull-request@v6 |
| 56 | + with: |
| 57 | + branch: chore/bump-dnscrypt-proxy |
| 58 | + base: testing |
| 59 | + title: "chore: bump dnscrypt-proxy to ${{ steps.upstream.outputs.latest }}" |
| 60 | + commit-message: "chore: bump dnscrypt-proxy to ${{ steps.upstream.outputs.latest }}" |
| 61 | + body: | |
| 62 | + This PR automatically updates DNSCRYPT_PROXY_VERSION |
| 63 | + to the latest upstream dnscrypt-proxy release: ${{ steps.upstream.outputs.latest }} |
| 64 | +
|
| 65 | + When merged, the testing branch will rebuild the Docker image |
| 66 | + and publish new :testing and :testing-<version> tags. |
| 67 | + labels: dependencies |
0 commit comments