Console friendly switches and documentation

+ Add ARM64 binary release
+ Draft for github actions.
This commit is contained in:
2021-05-09 04:32:20 +01:00
parent c2efa43dcb
commit 8bbde1f600
8 changed files with 155 additions and 40 deletions
+23 -12
View File
@@ -33,15 +33,21 @@ jobs:
- name: Setting environment variables
id: get_env
run: |
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/lukaszraczylo/semver-generator/releases/latest \
| grep browser_download_url \
| grep semver-gen-linux-amd64 \
| cut -d '"' -f 4)
curl -s -L -o semver-gen "$DOWNLOAD_URL" && chmod +x semver-gen
TMP_SANITISED_REPOSITORY_NAME=$(echo ${{ github.event.repository.name }} | sed -e 's|\.|-|g')
TMP_GITHUB_COMMITS_COUNT=$(git rev-list --count HEAD)
TMP_GITHUB_COUNT_NUMBER=$(echo ${GITHUB_RUN_NUMBER})
TMP_RELEASE_VERSION=$(./semver-gen generate -l -c config-release.yaml | sed -e 's|SEMVER ||g')
echo "::set-output name=SANITISED_REPOSITORY_NAME::$TMP_SANITISED_REPOSITORY_NAME"
echo "::set-output name=DOCKER_IMAGE::ghcr.io/${{ github.repository_owner }}/$TMP_SANITISED_REPOSITORY_NAME"
echo "::set-output name=GITHUB_COMMIT_NUMBER::$TMP_GITHUB_COMMITS_COUNT"
echo "::set-output name=GITHUB_SHA::$(echo ${GITHUB_SHA::8})"
echo "::set-output name=GITHUB_RUN_ID::$TMP_GITHUB_COUNT_NUMBER"
echo "::set-output name=RELEASE_VERSION::1.$TMP_GITHUB_COMMITS_COUNT.$TMP_GITHUB_COUNT_NUMBER"
echo "::set-output name=RELEASE_VERSION::$TMP_RELEASE_VERSION"
test:
needs: [ prepare ]
@@ -53,9 +59,6 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Configure git for private modules
run: |
git config --global url."https://${{ secrets.GHCR_TOKEN }}:x-oauth-basic@github.com/${{ github.repository_owner }}".insteadOf "https://github.com/${{ github.repository_owner }}"
- name: Lint Code Base
if: env.ENABLE_CODE_LINT == true
env:
@@ -81,7 +84,6 @@ jobs:
uses: actions/checkout@v2
- name: Configure git for private modules
run: |
git config --global url."https://${{ secrets.GHCR_TOKEN }}:x-oauth-basic@github.com/${{ github.repository_owner }}".insteadOf "https://github.com/${{ github.repository_owner }}"
make update
- name: WriteGoList
run: go list -json -m all > go.list
@@ -149,26 +151,35 @@ jobs:
image: "${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }}"
fail-build: true
release:
name: Create Release
build-binary:
needs: [ prepare, test, code_scans ]
name: Binary compilation and release
runs-on: ubuntu-latest
needs: [ prepare, deploy ]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Compile binary
uses: thatisuday/go-cross-build@v1
with:
platforms: linux/amd64,darwin/amd64,windows/amd64,linux/arm64,darwin/amd64
name: semver-gen
package: ./
compress: false
dest: dist
- name: Get list of the commits since last release
run: |
echo "$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")" > .release_notes
- name: Create Release
id: create_release
uses: actions/create-release@main
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.repository.name }}/${{ needs.prepare.outputs.RELEASE_VERSION }}
release_name: v${{ needs.prepare.outputs.RELEASE_VERSION }}
files: dist/semver-gen-*
tag_name: ${{ needs.prepare.outputs.RELEASE_VERSION }}
name: ${{ needs.prepare.outputs.RELEASE_VERSION }}
body_path: .release_notes
draft: false
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}