Skip to content

Template Repository Initialization #14

Template Repository Initialization

Template Repository Initialization #14

Workflow file for this run

name: Template Repository Initialization
on:
# Triggers the workflow on creation of repository
create:
workflow_dispatch:
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 "/# NOMAD Oasis Distribution/,/button on the right./d" README.md
sed -i "s|FAIRmat-NFDI/nomad-distribution-template|${{ github.repository }}|g" README.md
sed -i "s|FAIRmat-NFDI|${{ github.repository_owner }}|g" README.md
sed -i "s|nomad-distribution-template|${{ github.event.repository.name }}|g" README.md
sed -i "s|template https://github.com/${{ github.repository }}|template https://github.com/FAIRmat-NFDI/nomad-distribution-template|g" README.md
sed -i "s|${{ github.repository }}/releases/latest|FAIRmat-NFDI/nomad-distribution-template/releases/latest|g" README.md
sed -i "s|@ git+https://github.com/${{ github.repository_owner }}|@ git+https://github.com/FAIRmat-NFDI|g" 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
# Replaces the template repository name in the nomad config with the new one
- name: Update nomad.yaml
run: |
export image_name="${{ github.repository }}"
sed -i "s|fairmat-nfdi/nomad-distribution-template|${image_name,,}|g" configs/nomad.yaml
# 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