-
Notifications
You must be signed in to change notification settings - Fork 19
executable file
·108 lines (96 loc) · 3.51 KB
/
Copy pathci.yml
File metadata and controls
executable file
·108 lines (96 loc) · 3.51 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Continuous Integration
on:
push:
pull_request:
jobs:
ci:
name: CI for Preside Data API extension
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Setup flow variables
run: |
branch=${GITHUB_REF##*/}
publish=false
if [[ "{{ env.event.name }}" != "pull_request" ]] ; then
if [[ $branch == release-* ]] || [[ $branch == v* ]] ; then
publish=true
fi
fi
echo "PUBLISH=$publish" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies
uses: pixl8/github-action-box-install@v2
- name: Run tests
uses: pixl8/github-action-box-test@v3
with:
boxjson_dir: /
test_dir: /tests
test_server_json: /server-dataapitests.json
output_file: /tests/test-results.txt
verbose: true
- name: Upload Test Results Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: tests/test-results.txt
- name: Push to Translation Manager
if: "env.PUBLISH == 'true'"
uses: pixl8/github-action-push-to-translation-manager@v1
with:
translations_api_key: ${{ secrets.TRANSLATIONS_API_KEY }}
- name: Generate release version number
if: "env.PUBLISH == 'true'"
id: versiongen
uses: pixl8/github-action-twgit-release-version-generator@v2
- name: Inject version into box json
if: "env.PUBLISH == 'true'"
uses: dominicwatson/github-action-envsubst@v1
with:
files: box.json manifest.json
patterns: $VERSION_NUMBER
env:
VERSION_NUMBER: ${{ steps.versiongen.outputs.semver_release_string }}
- name: Build static assets with grunt
if: "env.PUBLISH == 'true'"
shell: bash
run: |
cd assets &&
npm install &&
grunt &&
rm -rf node_modules
- name: Zip project
if: "env.PUBLISH == 'true'"
run: zip -rq $ZIP_FILE * -x jmimemagic.log -x .* -x *.sh -x *.log -x tests/**\*
shell: bash
env:
ZIP_FILE: ${{ steps.versiongen.outputs.semver_release_number }}.zip
- name: Create Release
if: "env.PUBLISH == 'true'"
id: create_release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.RELEASE_PAT }}
tag_name: ${{ steps.versiongen.outputs.semver_release_string }}
name: Release ${{ steps.versiongen.outputs.semver_release_string }}
target_commitish: ${{ github.sha }}
prerelease: ${{ steps.versiongen.outputs.semver_release_is_snapshot }}
files: ${{ steps.versiongen.outputs.semver_release_number }}.zip
- name: Inject download location
if: env.PUBLISH == 'true' && steps.create_release.outcome == 'success'
uses: DominicWatson/github-action-envsubst@stable
with:
files: box.json
env:
DOWNLOAD_URL: ${{ steps.create_release.outcome == 'success' && fromJson(steps.create_release.outputs.assets)[0].browser_download_url || '' }}
- name: Publish to forgebox
if: env.PUBLISH == 'true' && steps.create_release.outcome == 'success'
uses: pixl8/github-action-box-publish@v3
with:
forgebox_user: ${{ secrets.FORGEBOX_USER }}
forgebox_pass: ${{ secrets.FORGEBOX_PASS }}