|
0 |
name: Merge to release
|
|
1 |
|
|
2 |
on:
|
|
3 |
push:
|
|
4 |
branches:
|
|
5 |
- master
|
|
6 |
workflow_dispatch:
|
|
7 |
inputs:
|
|
8 |
commit_message:
|
|
9 |
description: Commit message
|
|
10 |
required: true
|
|
11 |
|
|
12 |
jobs:
|
|
13 |
release:
|
|
14 |
runs-on: ubuntu-latest
|
|
15 |
env:
|
|
16 |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
17 |
DISTRIBUTION_UPDATER_TOKEN: "${{ secrets.DISTRIBUTION_UPDATER_TOKEN }}"
|
|
18 |
steps:
|
|
19 |
- uses: actions/checkout@v2
|
|
20 |
if: github.event_name == 'push'
|
|
21 |
- uses: actions/checkout@v2
|
|
22 |
if: github.event_name == 'workflow_dispatch'
|
|
23 |
with:
|
|
24 |
fetch-depth: 0
|
|
25 |
|
|
26 |
- name: Release branch version
|
|
27 |
id: release
|
|
28 |
run: echo ::set-output name=branch::v1.0.1
|
|
29 |
- name: Checkout release branch
|
|
30 |
uses: actions/checkout@v2
|
|
31 |
with:
|
|
32 |
ref: ${{ steps.release.outputs.branch }}
|
|
33 |
path: './release'
|
|
34 |
|
|
35 |
- name: Check for relevant changes
|
|
36 |
if: github.event_name == 'push'
|
|
37 |
uses: dorny/paths-filter@v2
|
|
38 |
id: update
|
|
39 |
with:
|
|
40 |
list-files: shell
|
|
41 |
filters: |
|
|
42 |
updated:
|
|
43 |
- added|modified: [ '*.csl', 'dependent/*.csl', '*.xml', 'README.md' ]
|
|
44 |
deleted:
|
|
45 |
- deleted: [ '*.csl', 'dependent/*.csl', '*.xml' ]
|
|
46 |
workflows:
|
|
47 |
- added|modified: .github/workflows/*.yaml
|
|
48 |
|
|
49 |
- name: Changed files
|
|
50 |
if: github.event_name == 'push'
|
|
51 |
run: |
|
|
52 |
echo updated: ${{ steps.update.outputs.updated_files }}
|
|
53 |
echo deleted: ${{ steps.update.outputs.deleted_files }}
|
|
54 |
echo workflows: ${{ steps.update.outputs.workflows_files }}
|
|
55 |
|
|
56 |
- name: Set up Ruby
|
|
57 |
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.update.outputs.updated == 'true' || steps.update.outputs.deleted == 'true'))
|
|
58 |
uses: ruby/setup-ruby@v1
|
|
59 |
with:
|
|
60 |
ruby-version: 3.0.0
|
|
61 |
- name: but use cache to speed that up
|
|
62 |
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.update.outputs.updated == 'true' || steps.update.outputs.deleted == 'true'))
|
|
63 |
uses: actions/cache@v2
|
|
64 |
with:
|
|
65 |
path: vendor/bundle
|
|
66 |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
|
67 |
restore-keys: |
|
|
68 |
${{ runner.os }}-gems-
|
|
69 |
- name: Bundle install
|
|
70 |
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.update.outputs.updated == 'true' || steps.update.outputs.deleted == 'true'))
|
|
71 |
run: |
|
|
72 |
bundle config path vendor/bundle
|
|
73 |
bundle update sheldon --jobs 4 --retry 3
|
|
74 |
|
|
75 |
- name: Populate new branch
|
|
76 |
run: bundle exec sheldon --token=$GITHUB_TOKEN --verbose --populate release
|
|
77 |
if: github.event_name == 'workflow_dispatch'
|
|
78 |
|
|
79 |
- name: update the timestamps and add the changes
|
|
80 |
run: bundle exec sheldon --token=$GITHUB_TOKEN --verbose --release release ${{ steps.update.outputs.updated_files }}
|
|
81 |
if: github.event_name == 'push' && steps.update.outputs.updated == 'true'
|
|
82 |
|
|
83 |
- name: delete deleted files
|
|
84 |
run: cd release && git rm ${{ steps.update.outputs.deleted_files }}
|
|
85 |
if: github.event_name == 'push' && steps.update.outputs.deleted == 'true'
|
|
86 |
|
|
87 |
- uses: stefanzweifel/git-auto-commit-action@v4
|
|
88 |
with:
|
|
89 |
repository: 'release'
|
|
90 |
commit_message: Releasing ${{ steps.update.outputs.updated_files }} ${{ steps.update.outputs.deleted_files }}
|
|
91 |
if: github.event_name == 'push' && (steps.update.outputs.updated == 'true' || steps.update.outputs.deleted == 'true')
|
|
92 |
|
|
93 |
- uses: stefanzweifel/git-auto-commit-action@v4
|
|
94 |
with:
|
|
95 |
repository: 'release'
|
|
96 |
commit_message: ${{ github.event.inputs.commit_message }}
|
|
97 |
if: github.event_name == 'workflow_dispatch'
|
|
98 |
|
|
99 |
# https://styles-update.zotero.org:8826/ is for Zotero (styles page, API's citation server, client style updates, etc.)
|
|
100 |
- name: ping Zotero servers
|
|
101 |
if: github.repository == 'citation-style-language/styles'
|
|
102 |
run: |
|
|
103 |
curl -H 'Content-Length:' -H "Authorization: $ZOTERO_UPDATE_TOKEN" -F 'payload={"type":"push","branch":"${{ steps.release.outputs.branch }}","status":0,"commit":"'$GITHUB_SHA'"}' https://styles-update.zotero.org:8826/
|
|
104 |
|
|
105 |
- name: Copy workflows to locales repository
|
|
106 |
if: github.repository == 'citation-style-language/styles' && steps.update.outputs.workflows == 'true'
|
|
107 |
uses: drud/action-cross-commit@master
|
|
108 |
with:
|
|
109 |
source-folder: .github/workflows
|
|
110 |
destination-repository: https://csl-bot:${{ secrets.CSLBOT_TOKEN }}@github.com/citation-style-language/locales
|
|
111 |
destination-folder: .github/workflows
|
|
112 |
destination-branch: master
|
|
113 |
git-user: "csl-bot"
|
|
114 |
git-user-email: github@citationstyles.org
|
|
115 |
git-commit-message: copied ${{ steps.update.outputs.workflows_files }} from styles
|