Merge pull request #1743 from Crazymanbos/master #4895
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: Continuous integration | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
# GitHub Actions usage is FREE for both public repositories and self-hosted runners. | |
# We can use it to build our project and do some automated builds and in future quality tests. | |
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
# checkout project | |
- uses: actions/checkout@v3 | |
if: ${{ github.event_name != 'pull_request' }} | |
- uses: actions/checkout@v3 | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
# setup go | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '^1.17' | |
# byte order mark | |
- name: Byte order mark check | |
working-directory: utils | |
run: | | |
go run . -fix-bom-only | |
- name: Renormalize line endings if needed | |
continue-on-error: true | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: '[CI] renormalize line endings' | |
default_author: github_actions | |
add: '. --renormalize' | |
- name: Check if rendered files are changed | |
id: changed-rendered-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
achievements/*.vdf | |
rich_presence/*.vdf | |
# build PR | |
- name: Build translations | |
working-directory: utils | |
if: steps.changed-rendered-files.outputs.test_any_changed != 'true' | |
run: | | |
go run . | |
- name: Build translations and rendered files | |
working-directory: utils | |
if: steps.changed-rendered-files.outputs.test_any_changed == 'true' | |
run: | | |
go run . -render | |
# check for unwanted differences from commit | |
- name: Check for unintended changes | |
run: | | |
changes=$(git diff | wc -l) | |
if [[ $changes -gt 0 ]]; then | |
git status | |
git diff --color | |
/bin/false | |
fi | |
# update translation progress | |
- name: Update translation progress document | |
if: github.repository == 'ReactiveDrop/reactivedrop_translations' && github.ref == 'refs/heads/master' && github.event_name == 'push' | |
working-directory: utils | |
run: | | |
go run . -render | |
go run . -markdown > ../PROGRESS.md | |
- name: Commit translation progress document | |
if: github.repository == 'ReactiveDrop/reactivedrop_translations' && github.ref == 'refs/heads/master' && github.event_name == 'push' | |
continue-on-error: true | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: '[CI] update translation progress' | |
default_author: github_actions |