forked from ReactiveDrop/reactivedrop_translations
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (82 loc) · 2.9 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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