-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (54 loc) · 2.17 KB
/
publish_output.yml
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
name: Publish output
on:
workflow_dispatch: {}
schedule:
- cron: '2 15 1 * *'
jobs:
publish_output:
runs-on: ubuntu-latest
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Get testing workflow id
shell: bash
run: |
RESPONSE=$(curl --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
https://api.github.com/repos/${{ github.repository }}/actions/runs/1794769003)
echo "RESPONSE=$RESPONSE"
WORKFLOW_ID=$(echo $RESPONSE | jq -r .workflow_id)
echo "WORKFLOW_ID=$WORKFLOW_ID" >> $GITHUB_ENV
echo "Workflow id: ${WORKFLOW_ID}"
if [[ "${WORKFLOW_ID}" -eq "null" ]] ; then echo "Could not get workflow ID"; exit 1 ; fi
- name: Get previous testing status
shell: bash
id: last_status
run: |
last_status=$(curl --silent --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ env.WORKFLOW_ID }}/runs?per_page=1&status=completed&branch=${{ env.BRANCH_NAME }}" \
| jq -r .workflow_runs[0].conclusion)
echo "LAST_STATUS=$last_status" >> $GITHUB_ENV
echo "Status of the previous build: ${LAST_STATUS}"
- name: Check status
shell: bash
id: check_status
run: |
if [[ "${LAST_STATUS}" -ne "success" ]] ; then echo "Last test status was not success: '${LAST_STATUS}'" ; exit 1 ; fi
- uses: actions/checkout@v2
with:
ref: main
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
pip install 'poetry<1.2'
poetry install
- name: Setup git access
run: |
git config --global user.name 'Costas Basdekis'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
- name: Publish
run: ./publish_output.sh