|
| 1 | +--- |
| 2 | +name: Make New |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + repo: |
| 8 | + description: GitHub repository name (new-repo) |
| 9 | + required: true |
| 10 | + title: |
| 11 | + description: Package title (New Package) |
| 12 | + required: true |
| 13 | + description: |
| 14 | + description: Short package description (Foos and bars.) |
| 15 | + required: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + repository: |
| 19 | + name: Create new repository |
| 20 | + runs-on: ubuntu-latest |
| 21 | + timeout-minutes: 30 |
| 22 | + steps: |
| 23 | + - name: Create repository |
| 24 | + run: | |
| 25 | + gh extension install mislav/gh-repo-collab |
| 26 | + gh repo create --internal --disable-wiki --description "$DESCRIPTION" $REPO |
| 27 | + gh repo edit $REPO --delete-branch-on-merge |
| 28 | + gh repo edit $REPO --enable-projects=false |
| 29 | + gh repo-collab add $REPO $CODEOWNER --permission admin |
| 30 | + env: |
| 31 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 32 | + CODEOWNER: ${{ github.actor }} |
| 33 | + REPO: seamapi/${{ github.event.inputs.repo }} |
| 34 | + DESCRIPTION: ${{ github.event.inputs.description }} |
| 35 | + bootstrap: |
| 36 | + name: Bootstrap repository |
| 37 | + runs-on: ubuntu-latest |
| 38 | + timeout-minutes: 30 |
| 39 | + needs: repository |
| 40 | + steps: |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@v3 |
| 43 | + with: |
| 44 | + fetch-depth: 0 |
| 45 | + token: ${{ secrets.GH_TOKEN }} |
| 46 | + - name: Import GPG key |
| 47 | + uses: crazy-max/ghaction-import-gpg@v5 |
| 48 | + with: |
| 49 | + git_user_signingkey: true |
| 50 | + git_commit_gpgsign: true |
| 51 | + git_committer_name: ${{ secrets.GIT_USER_NAME }} |
| 52 | + git_committer_email: ${{ secrets.GIT_USER_EMAIL }} |
| 53 | + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} |
| 54 | + passphrase: ${{ secrets.GPG_PASSPHRASE }} |
| 55 | + - name: Replace makenew boilerplate |
| 56 | + run: ./makenew.sh |
| 57 | + env: |
| 58 | + CI: 'true' |
| 59 | + mk_codeowner: ${{ github.actor }} |
| 60 | + mk_repo: ${{ github.event.inputs.repo }} |
| 61 | + mk_slug: '@seamapi/${{ github.event.inputs.repo }}' |
| 62 | + mk_title: ${{ github.event.inputs.title }} |
| 63 | + mk_description: ${{ github.event.inputs.description }} |
| 64 | + - name: Set origin |
| 65 | + run: | |
| 66 | + git remote add origin $ORIGIN |
| 67 | + git config --add --bool push.autoSetupRemote true |
| 68 | + env: |
| 69 | + ORIGIN: https://github.com/seamapi/${{ github.event.inputs.repo }}.git |
| 70 | + - name: Commit |
| 71 | + uses: stefanzweifel/git-auto-commit-action@v4 |
| 72 | + with: |
| 73 | + skip_fetch: true |
| 74 | + skip_checkout: true |
| 75 | + commit_message: Replace makenew boilerplate |
| 76 | + commit_user_name: ${{ secrets.GIT_USER_NAME }} |
| 77 | + commit_user_email: ${{ secrets.GIT_USER_EMAIL }} |
| 78 | + commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}> |
| 79 | + version: |
| 80 | + name: Cut initial version |
| 81 | + runs-on: ubuntu-latest |
| 82 | + timeout-minutes: 30 |
| 83 | + needs: bootstrap |
| 84 | + steps: |
| 85 | + - name: Cut version |
| 86 | + run: gh workflow run version.yml --repo $REPO --raw-field version=patch |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 89 | + REPO: seamapi/${{ github.event.inputs.repo }} |
0 commit comments