Skip to content

Template Repository Initialization #3

Template Repository Initialization

Template Repository Initialization #3

Workflow file for this run

name: Template Repository Initialization
on:
# Triggers the workflow on creation of repository
create:
# Allows you to run this workflow manually from the Actions tab
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 "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.yml
working-directory: ./nomad-oasis_files
run: |
sed -i "s|FAIRMAT_NFDI/nomad-distribution-template|${{ github.repository }}|g" docker-compose.yaml
zip -r nomad-oasis.zip 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