|
2 | 2 |
|
3 | 3 | This repository contains reusable workflows and scripts to be used with GitHub Actions. |
4 | 4 |
|
5 | | -For versioning, we're using a shifting tag strategy, with the current version tag - e.g. `v1` - being updated until |
6 | | -there's a breaking change, at which point it will stay as is and we start using a new tag, `v2`, etc... |
| 5 | +## Updater |
7 | 6 |
|
8 | | -This allows consumers to be on the latest version of a compatible workflow. If you prefer, you can instead pin to a |
9 | | -specific commit. |
| 7 | +Dependency updater - see [updater.yml](.github/workflows/updater.yml) - updates dependencies to the latest published git tag. |
10 | 8 |
|
11 | | -## Contributing |
| 9 | +### Example workflow definition |
12 | 10 |
|
13 | | -Note on versioning: Reusable workflows don't support version selection based on the major version specified |
14 | | -by the user - instead, an exact ref is needed, that's why we have to shift the tag as needed. |
| 11 | +```yaml |
| 12 | +name: Update Dependencies |
| 13 | +on: |
| 14 | + # Run every day. |
| 15 | + schedule: |
| 16 | + - cron: '0 3 * * *' |
| 17 | + # And on on every PR merge so we get the updated dependencies ASAP, and to make sure the changelog doesn't conflict. |
| 18 | + push: |
| 19 | + branches: |
| 20 | + - main |
| 21 | +jobs: |
| 22 | + # Update a git submodule |
| 23 | + cocoa: |
| 24 | + uses: getsentry/github-workflows/.github/workflows/updater.yml@v2 |
| 25 | + with: |
| 26 | + path: modules/sentry-cocoa |
| 27 | + name: Cocoa SDK |
| 28 | + pattern: '^1\.' # Limit to major version '1' |
| 29 | + secrets: |
| 30 | + api-token: ${{ secrets.CI_DEPLOY_KEY }} |
15 | 31 |
|
16 | | -To shift the tag to the current commit: |
| 32 | + # Update a properties file |
| 33 | + cli: |
| 34 | + uses: getsentry/github-workflows/.github/workflows/updater.yml@v2 |
| 35 | + with: |
| 36 | + path: sentry-cli.properties |
| 37 | + name: CLI |
| 38 | + secrets: |
| 39 | + api-token: ${{ secrets.CI_DEPLOY_KEY }} |
17 | 40 |
|
18 | | -```shell-script |
19 | | -git push |
20 | | -git tag -d v1 |
21 | | -git tag v1 |
22 | | -git push --tags --force |
| 41 | + # Update using a custom shell script, see scripts/update-dependency.ps1 for the required arguments |
| 42 | + agp: |
| 43 | + uses: getsentry/github-workflows/.github/workflows/updater.yml@v2 |
| 44 | + with: |
| 45 | + path: script.ps1 |
| 46 | + name: Gradle Plugin |
| 47 | + secrets: |
| 48 | + api-token: ${{ secrets.CI_DEPLOY_KEY }} |
23 | 49 | ``` |
| 50 | +
|
| 51 | +### Inputs |
| 52 | +
|
| 53 | +* `path`: Dependency path in the source repository, this can be either a submodule, a .properties file or a shell script. |
| 54 | + * type: string |
| 55 | + * required: true |
| 56 | +* `name`: Name used for a changelog entry. |
| 57 | + * type: string |
| 58 | + * required: true |
| 59 | +* `pattern`: RegEx pattern that will be matched against available versions when picking the latest one. |
| 60 | + * type: string |
| 61 | + * required: false |
| 62 | + * default: '' |
| 63 | +* `changelog-section`: Section header to attach the changelog entry to. |
| 64 | + * type: string |
| 65 | + * required: false |
| 66 | + * default: Dependencies |
| 67 | +* `runs-on`: GitHub Actions virtual environment name to run the udpater job on. |
| 68 | + * type: string |
| 69 | + * required: false |
| 70 | + * default: ubuntu-latest |
| 71 | + |
| 72 | +### Secrets |
| 73 | + |
| 74 | +* `api-token`: GH authentication token to create PRs with & push. |
| 75 | + If you provide the usual `${{ github.token }}`, no followup CI will run on the created PR. |
| 76 | + If you want CI to run on the PRs created by the Updater, you need to provide custom user-specific auth token. |
0 commit comments