-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (42 loc) · 1.69 KB
/
initialize.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
name: Template Repository Initialization
on:
# Triggers the workflow on creation of repository
create:
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: write
jobs:
initialize_repository:
if: github.repository != 'FAIRmat-NFDI/nomad-distribution-template'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Replaces the template repository name in the README with the new one
- name: Update README
run: |
sed -i "s|GITHUB_REPOSITORY_OWNER|${{ github.repository_owner }}|g" template_README.md
sed -i "s|GITHUB_REPOSITORY|${{ github.repository }}|g" template_README.md
mv template_README.md README.md
# Replaces the template repository name in the docker config file with the new one
- name: Update docker-compose.yaml
run: |
export image_name="${{ github.repository }}"
sed -i "s|fairmat-nfdi/nomad-distribution-template|${image_name,,}|g" docker-compose.yaml
mkdir nomad-oasis
cp docker-compose.yaml nomad-oasis
zip -ur nomad-oasis.zip nomad-oasis
rm -r nomad-oasis
# Deletes this workflow file to prevent it from running on branch creation
- name: Delete initialization workflow
run: rm .github/workflows/initialize.yml
# Commits all changes
- name: Commit repository initialization
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
git commit -am "Repository initialization"
git push