|
| 1 | +name: Create Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "[0-9]+.[0-9]+.[0-9]+*" |
| 7 | + |
| 8 | +jobs: |
| 9 | + release: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Set environment variables |
| 14 | + run: | |
| 15 | + # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable |
| 16 | + echo "CHANGELOG_PATH=${{ runner.temp }}/CHANGELOG.md" >> "$GITHUB_ENV" |
| 17 | +
|
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v2 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Install Taskfile |
| 24 | + uses: arduino/setup-task@v1 |
| 25 | + with: |
| 26 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + version: 3.x |
| 28 | + |
| 29 | + - name: Install Go |
| 30 | + uses: actions/setup-go@v2 |
| 31 | + with: |
| 32 | + go-version: "1.14" |
| 33 | + |
| 34 | + - name: Build project |
| 35 | + run: task build |
| 36 | + |
| 37 | + - name: Create changelog |
| 38 | + uses: arduino/create-changelog@v1 |
| 39 | + with: |
| 40 | + tag-regex: '^[0-9]+\.[0-9]+\.[0-9]+.*$' |
| 41 | + filter-regex: '^\[(skip|changelog)[ ,-](skip|changelog)\].*' |
| 42 | + case-insensitive-regex: true |
| 43 | + changelog-file-path: ${{ env.CHANGELOG_PATH }} |
| 44 | + |
| 45 | + - name: Identify pre-releases |
| 46 | + id: prerelease |
| 47 | + env: |
| 48 | + # See: https://github.com/fsaintjacques/semver-tool/releases/latest |
| 49 | + TOOL_VERSION: 3.2.0 |
| 50 | + run: | |
| 51 | + INSTALL_PATH="${{ runner.temp }}/semver-tool" |
| 52 | + mkdir -p "$INSTALL_PATH" |
| 53 | + wget --quiet --directory-prefix="$INSTALL_PATH" https://github.com/fsaintjacques/semver-tool/archive/${{ env.TOOL_VERSION }}.zip |
| 54 | + unzip -p "${INSTALL_PATH}/${{ env.TOOL_VERSION }}.zip" semver-tool-${{ env.TOOL_VERSION }}/src/semver >"${INSTALL_PATH}/semver" |
| 55 | + chmod +x "${INSTALL_PATH}/semver" |
| 56 | + if [[ $("${INSTALL_PATH}/semver" get prerel "${GITHUB_REF/refs\/tags\//}") ]]; then |
| 57 | + echo "::set-output name=is-pre::true"; |
| 58 | + fi |
| 59 | +
|
| 60 | + - name: Create Release |
| 61 | + uses: ncipollo/release-action@v1 |
| 62 | + with: |
| 63 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + bodyFile: ${{ env.CHANGELOG_PATH }} |
| 65 | + prerelease: ${{ steps.prerelease.outputs.is-pre }} |
| 66 | + artifacts: libraries-repository-engine |
0 commit comments