|
12 | 12 |
|
13 | 13 | env: |
14 | 14 | BRANCH_PREFIX: "update/" |
15 | | - DEFAULT_BRANCH: "main" |
16 | 15 |
|
17 | 16 | jobs: |
18 | 17 | update-best-of-list: |
19 | 18 | runs-on: ubuntu-latest |
20 | 19 | steps: |
21 | | - - if: ${{ github.event.inputs != null && github.event.inputs.version != null }} |
22 | | - name: set-version-from-input |
| 20 | + - name: Set version from input |
| 21 | + if: ${{ github.event.inputs != null && github.event.inputs.version != null }} |
23 | 22 | run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV |
24 | | - - if: ${{ ! (env.VERSION != null && env.VERSION != '') }} |
25 | | - name: set-version-via-date |
| 23 | + - name: Set version via date |
| 24 | + if: ${{ ! (env.VERSION != null && env.VERSION != '') }} |
26 | 25 | run: echo "VERSION=$(date '+%Y.%m.%d')" >> $GITHUB_ENV |
27 | | - - uses: actions/checkout@v2 |
28 | | - - name: check-version-tag |
| 26 | + - uses: actions/checkout@v3 |
| 27 | + - name: Append time to version if necessary |
29 | 28 | shell: bash |
30 | 29 | run: | |
31 | 30 | git fetch --tags --force |
32 | 31 | git show-ref --tags --verify --quiet -- "refs/tags/${{ env.VERSION }}" && echo "VERSION=$(date '+%Y.%m.%d-%H.%M')" >> $GITHUB_ENV || exit 0 |
33 | | - - name: create-update-branch |
34 | | - uses: peterjgrainger/action-create-branch@v2.0.1 |
35 | | - env: |
36 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
37 | | - with: |
38 | | - branch: "${{ env.BRANCH_PREFIX }}${{ env.VERSION }}" |
39 | | - - uses: actions/checkout@v2 |
40 | | - with: |
41 | | - fetch-depth: 0 |
42 | | - ref: ${{ env.BRANCH_PREFIX }}${{ env.VERSION }} |
43 | | - token: ${{ secrets.GITHUB_TOKEN }} |
44 | | - env: |
45 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
46 | | - - name: install best-of-generator |
| 32 | + - name: Install best-of generator |
47 | 33 | run: pip install "best-of @ git+https://github.com/YDX-2147483647/best-of-generator.git@best-of-bits" |
48 | | - - name: update-best-of-list |
| 34 | + - name: Update best-of list |
49 | 35 | run: >- |
50 | 36 | best-of generate projects.yaml |
51 | 37 | --libraries-key=${{ secrets.LIBRARIES_KEY }} |
52 | 38 | --github-key=${{ secrets.GITHUB_TOKEN }} |
53 | 39 | --gitee-key=${{ secrets.GITEE_API_KEY }} |
54 | | - - name: push-update |
55 | | - uses: stefanzweifel/git-auto-commit-action@v4 |
| 40 | + - name: Create pull request |
| 41 | + uses: peter-evans/create-pull-request@v5 |
56 | 42 | with: |
57 | 43 | branch: ${{ env.BRANCH_PREFIX }}${{ env.VERSION }} |
58 | | - commit_user_name: best-of update |
59 | | - commit_user_email: actions@github.com |
60 | | - commit_message: Update best-of list for version ${{ env.VERSION }} |
61 | | - tagging_message: ${{ env.VERSION }} |
62 | | - skip_dirty_check: true |
63 | | - commit_options: "--allow-empty" |
64 | | - - name: create-pull-request |
65 | | - shell: bash |
66 | | - run: | |
67 | | - # Stops script execution if a command has an error |
68 | | - set -e |
69 | | - curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.2 |
70 | | - bin/hub pull-request -b ${{ env.DEFAULT_BRANCH }} -h ${{ env.BRANCH_PREFIX }}${{ env.VERSION }} --no-edit -m "Best-of update: ${{ env.VERSION }}" -m "To finish this update: Select <code>Merge pull request</code> below and <code>Confirm merge</code>. Also, make sure to publish the created draft release in the [releases section](../releases) as well." || true |
71 | | - rm bin/hub |
72 | | - env: |
73 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
74 | | - - name: create-release |
75 | | - uses: actions/create-release@v1 |
| 44 | + committer: best-of update <actions@github.com> |
| 45 | + commit-message: Update best-of list for version ${{ env.VERSION }} |
| 46 | + title: "Best-of update: ${{ env.VERSION }}" |
| 47 | + body: | |
| 48 | + To finish this update: Select `Merge pull request` below and `Confirm merge`. |
| 49 | + Also, make sure to publish the created draft release in the [releases section](../releases) as well. |
| 50 | + - name: Publish release |
| 51 | + uses: softprops/action-gh-release@v1 |
76 | 52 | env: |
77 | 53 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
78 | 54 | with: |
79 | 55 | tag_name: ${{ env.VERSION }} |
80 | | - release_name: "Update: ${{ env.VERSION }}" |
| 56 | + name: "Update: ${{ env.VERSION }}" |
81 | 57 | body_path: "latest-changes.md" |
82 | 58 | draft: true |
83 | 59 | prerelease: false |
0 commit comments