Template Repository Initialization #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | | |
sed -i "s|FAIRmat-NFDI/nomad-distribution-template|${{ github.repository }}|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 |