chore(actions): update aws-actions/amazon-ecr-login action to v2 (#109) #75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Merge master | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
prepare: | |
name: Calculate Version and build number | |
runs-on: ubuntu-22.04 | |
outputs: | |
build_number: ${{ steps.short_sha.outputs.value }} | |
new_release: ${{ steps.semantic.outputs.new_release_published }} | |
release: ${{ steps.version.outputs.value }} | |
release_notes: ${{ steps.semantic.outputs.new_release_notes }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.ACCESS_TOKEN }} | |
- uses: cycjimmy/semantic-release-action@v3 | |
id: semantic | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
with: | |
dry_run: true | |
semantic_version: 18.0.1 | |
- name: Git Short sha | |
id: short_sha | |
run: echo "value=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Remove prefix 'v' from version | |
id: version | |
run: echo "value=`echo ${{ steps.semantic.outputs.new_release_version }} | sed -r 's|v()|\1|'`" >> $GITHUB_OUTPUT | |
build: | |
if: needs.prepare.outputs.new_release == 'true' | |
name: Build | |
runs-on: ubuntu-22.04 | |
needs: | |
- prepare | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go.mod' | |
- name: Cache Go modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build for test | |
run: make build | |
releases: | |
if: needs.prepare.outputs.new_release == 'true' | |
name: Dev and Draft Releases | |
runs-on: ubuntu-22.04 | |
needs: | |
- prepare | |
- build | |
steps: | |
- name: Create Pre Release | |
uses: actions/create-release@v1 | |
env: | |
BUILD: ${{ needs.prepare.outputs.build_number }} | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
VERSION: ${{ needs.prepare.outputs.release }} | |
with: | |
tag_name: v${{ env.VERSION }}.${{ env.BUILD }} | |
release_name: ${{ env.VERSION }}.${{ env.BUILD }} | |
body: ${{ github.event.head_commit.message }} | |
prerelease: true | |
- name: Delete Previous drafts | |
uses: hugo19941994/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
- name: Create Draft Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
with: | |
tag_name: v${{ needs.prepare.outputs.release }} | |
release_name: ${{ needs.prepare.outputs.release }} | |
body: ${{ needs.prepare.outputs.release_notes }} | |
draft: true |