Update #415
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: Update | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '38 13 * * *' | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
updater/target | |
key: ${{ runner.os }}-cargo-and-updater-${{ hashFiles('.github/workflows/*.yml') }} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
target: ${{ matrix.target }} | |
toolchain: stable | |
profile: minimal | |
override: true | |
- name: Build updater | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --manifest-path updater/Cargo.toml | |
- name: Clone github/gitignore | |
uses: actions/checkout@v2 | |
with: | |
repository: github/gitignore | |
path: gitignores | |
ref: main | |
- name: Run updater | |
run: | | |
set -euxo pipefail | |
updater/target/debug/gitignores-updater \ | |
--output . \ | |
--cargo-toml-base updater/gitignores.toml \ | |
--gitignores-repo gitignores \ | |
--gh-env-file "$GITHUB_ENV" | |
rm -rf gitignores | |
- name: Check generated code | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
- name: Format | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
- name: Install MSRV | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: "1.37.0" | |
override: true | |
- name: Check generated code with MSRV | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
- name: Commit | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
if: env.new_version | |
with: | |
commit_message: Auto release ${{ env.new_version }} | |
tagging_message: "v${{ env.new_version }}" | |
- name: Output | |
id: output | |
run: echo "::set-output name=has_new_version::${{ contains(env.new_version, '.') }}" | |
outputs: | |
has_new_version: "${{ steps.output.outputs.has_new_version }}" | |
release: | |
uses: watchexec/gitignores/.github/workflows/release.yml@main | |
needs: update | |
if: needs.update.outputs.has_new_version == 'true' | |
secrets: | |
CARGO_TOKEN: "${{ secrets.CARGO_TOKEN }}" |