|
| 1 | +--- |
| 2 | +name: Make New |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + codeowner: |
| 8 | + description: Your GitHub username (my-user) |
| 9 | + required: true |
| 10 | + repo: |
| 11 | + description: GitHub repository name (new-repo) |
| 12 | + required: true |
| 13 | + slug: |
| 14 | + description: Package name (@seamapi/new-package) |
| 15 | + required: true |
| 16 | + title: |
| 17 | + description: Package title (New Package) |
| 18 | + required: true |
| 19 | + description: |
| 20 | + description: Short package description (Foos and bars.) |
| 21 | + required: true |
| 22 | + |
| 23 | +jobs: |
| 24 | + repository: |
| 25 | + name: Create new repository |
| 26 | + runs-on: ubuntu-latest |
| 27 | + timeout-minutes: 30 |
| 28 | + steps: |
| 29 | + - name: Create repository |
| 30 | + run: gh repo create --internal $REPO |
| 31 | + env: |
| 32 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 33 | + REPO: seamapi/${{ github.event.inputs.repo }} |
| 34 | + bootstrap: |
| 35 | + name: Bootstrap code |
| 36 | + runs-on: ubuntu-latest |
| 37 | + timeout-minutes: 30 |
| 38 | + needs: repository |
| 39 | + steps: |
| 40 | + - name: Checkout |
| 41 | + uses: actions/checkout@v3 |
| 42 | + with: |
| 43 | + ref: main |
| 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.event.inputs.codeowner }} |
| 60 | + mk_repo: ${{ github.event.inputs.repo }} |
| 61 | + mk_slug: ${{ github.event.inputs.slug }} |
| 62 | + mk_title: ${{ github.event.inputs.title }} |
| 63 | + mk_description: ${{ github.event.inputs.description }} |
| 64 | + - name: Commit |
| 65 | + uses: stefanzweifel/git-auto-commit-action@v4 |
| 66 | + with: |
| 67 | + commit_message: Replace makenew boilerplate |
| 68 | + commit_user_name: ${{ secrets.GIT_USER_NAME }} |
| 69 | + commit_user_email: ${{ secrets.GIT_USER_EMAIL }} |
| 70 | + commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}> |
| 71 | + - name: Push |
| 72 | + run: | |
| 73 | + git remote add origin $ORIGIN |
| 74 | + git push -u origin main |
| 75 | + env: |
| 76 | + ORIGIN: [email protected]:seamapi/${{ github.event.inputs.repo }}.git |
| 77 | + version: |
| 78 | + name: Cut initial version |
| 79 | + runs-on: ubuntu-latest |
| 80 | + timeout-minutes: 30 |
| 81 | + needs: bootstrap |
| 82 | + steps: |
| 83 | + - name: Cut version |
| 84 | + run: gh workflow run version.yml --repo $REPO --raw-field version=patch |
| 85 | + env: |
| 86 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 87 | + REPO: seamapi/${{ github.event.inputs.repo }} |
0 commit comments