Skip to content

Template Repository Initialization #1

Template Repository Initialization

Template Repository Initialization #1

Workflow file for this run

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