|
| 1 | +name: manual-dev |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | + workflow_run: |
| 7 | + workflows: ["build-dev"] |
| 8 | + types: [completed] |
| 9 | + |
| 10 | + pull_request: |
| 11 | + types: |
| 12 | + - closed |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: ${{ github.ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +defaults: |
| 19 | + run: |
| 20 | + # GitHub Actions run without a TTY device. This is a workaround to get one, |
| 21 | + # based on https://github.com/actions/runner/issues/241#issuecomment-2019042651 |
| 22 | + shell: 'script --return --quiet --log-out /dev/null --command "bash -e {0}"' |
| 23 | + |
| 24 | +env: |
| 25 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + GITHUB_OWNER: ${{ github.repository_owner }} |
| 27 | + GITHUB_REPO: ${{ github.event.repository.name }} |
| 28 | + GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} |
| 29 | + |
| 30 | +jobs: |
| 31 | + update: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} |
| 34 | + |
| 35 | + permissions: |
| 36 | + contents: write |
| 37 | + |
| 38 | + steps: |
| 39 | + - name: Checkout repository |
| 40 | + uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Tune dpkg |
| 43 | + uses: abbbi/github-actions-tune@v1 |
| 44 | + |
| 45 | + - name: Set dpkg |
| 46 | + run: sudo rm -f /usr/local/bin/dpkg |
| 47 | + |
| 48 | + - name: Tune apt |
| 49 | + uses: firebuild/apt-eatmydata-action@v1 |
| 50 | + |
| 51 | + - name: Check for release |
| 52 | + id: release |
| 53 | + continue-on-error: true |
| 54 | + uses: cardinalby/git-get-release-action@v1 |
| 55 | + with: |
| 56 | + latest: true |
| 57 | + |
| 58 | + - name: Fetch all data |
| 59 | + if: ${{ steps.release.outcome == 'success' }} |
| 60 | + continue-on-error: true |
| 61 | + uses: robinraju/release-downloader@v1 |
| 62 | + with: |
| 63 | + latest: true |
| 64 | + fileName: "*.zst" |
| 65 | + tarBall: false |
| 66 | + zipBall: false |
| 67 | + |
| 68 | + - name: Dry run |
| 69 | + id: update |
| 70 | + run: | |
| 71 | + docker run -v $PWD:/app --env-file <(env | grep GITHUB) \ |
| 72 | + ghcr.io/$GITHUB_OWNER/$GITHUB_REPO:master \ |
| 73 | + src/test/update.sh; echo "updated=$?" >> "$GITHUB_OUTPUT" |
| 74 | +
|
| 75 | + - name: Get date |
| 76 | + id: date |
| 77 | + run: echo "tag=$(date -u +%-Y.%-m).$((($(date -u +%-d)-1)/14))" >> "$GITHUB_OUTPUT" |
| 78 | + |
| 79 | + - name: Save database |
| 80 | + if: ${{ steps.update.outputs.updated == '0' }} |
| 81 | + uses: ncipollo/release-action@v1 |
| 82 | + with: |
| 83 | + artifacts: "*.zst" |
| 84 | + bodyFile: "CHANGELOG.md" |
| 85 | + tag: "v${{ steps.date.outputs.tag }}" |
| 86 | + commit: "master" |
| 87 | + allowUpdates: true |
0 commit comments