This repository has been archived by the owner on Jan 2, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 18
123 lines (104 loc) · 4.47 KB
/
seleryaction.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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# ./.github/workflows/libreselery
# Use LibreSelery as a simple Github action on your project workflow.
# For configuration create an .libreselery.yml file in your project repo.
name: seleryaction
#on:
# release:
# types: [created]
# # Sequence of patterns matched against refs/tags
# tags:
# - v* # Event to all release tags
on:
push:
branches:
- master
jobs:
libreselery:
name: seleryaction
runs-on: ubuntu-latest
steps:
# Check out the repo libreselery is working on.
- name: Checkout the target repository
uses: actions/checkout@v1
- name: print Repository_name and folder
run: |
REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")
echo ${HOME}/work/${REPOSITORY_NAME}/${REPOSITORY_NAME}
ls ${HOME}/work/${REPOSITORY_NAME}/${REPOSITORY_NAME}
echo "TARGET_PROJECT=${HOME}/work/${REPOSITORY_NAME}/${REPOSITORY_NAME}" >> $GITHUB_ENV
echo "GITHUB_REPOSITORY_NEW=$GITHUB_REPOSITORY" >> $GITHUB_ENV
#- name: Pull libreselery from dockerhub
# run: docker pull protontypes/libreselery
- name: Create container from local Dockerfile
run: docker build -t libreselery .
- name: Set env variables for folder paths that are used between steps
run: |
echo "results_folder=${HOME}/results_folder" >> $GITHUB_ENV
echo "config_folder=${HOME}/config_folder" >> $GITHUB_ENV
- name: Create result and config folder
run: |
mkdir -vp ${results_folder}/public
mkdir -vp $config_folder
- name: Give everyone permission to write folder
run: chmod -R a+rw $results_folder $config_folder
- name: Pass libreselery configuration from target project
run: |
echo "Use selery.yml from target project directory: ${TARGET_PROJECT}"
cat ${TARGET_PROJECT}/selery.yml
cp ${TARGET_PROJECT}/selery.yml $config_folder/selery.yml
- name: Pass tooling repository list
run: cp ${TARGET_PROJECT}/tooling_repos.yml $config_folder/tooling_repos.yml
continue-on-error: true
- name: Run LibreSelery on its own sources
run: >
docker run --rm
--env GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
--env LIBRARIES_API_KEY=${{ secrets.LIBRARIES_API_KEY }}
--env COINBASE_TOKEN=${{ secrets.COINBASE_TOKEN }}
--env COINBASE_SECRET=${{ secrets.COINBASE_SECRET }}
-v $PWD/:/home/selery/runningrepo/
-v $results_folder:/home/selery/results/
-v $config_folder:/home/selery/config/
libreselery
--directory=/home/selery/runningrepo/ --config=/home/selery/config/selery.yml --results_dir=/home/selery/results/ --tooling=/home/selery/config/tooling_repos.yml
# Upload the receipt file to github artifact.
- name: Upload the artifacts
uses: actions/upload-artifact@v1
with:
name: selery_dump
path: /home/runner/results_folder
- name: Verify a successful payout
run: |
cat ${results_folder}/receipt.txt
echo "Payout receipt found"
- name: Checkout Wiki Repo
uses: actions/checkout@v2
with:
repository: ${{ env.GITHUB_REPOSITORY_NEW }}.wiki
path: wiki
- name: Commit to the wiki repository
run: |
echo "Change dir to ${HOME}/work"
cd ./wiki
mkdir -p libreselery
cp ${results_folder}/public/* ./libreselery/
git config user.name github-actions
git config user.email [email protected]
git status
git add . -A
git commit -m "Action generated"
## You will need a privat access token since the GITHUB_TOKEN is not allowed to push to the wiki
- name: Push changes to the wiki repository
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.PAT_SELERY }}
repository: ${{ env.GITHUB_REPOSITORY_NEW }}.wiki
directory: wiki
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: protontypes/libreselery
tag_with_ref: true
tag_with_sha: true