ci: Main branch cicd added #2
Workflow file for this run
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: Test, Build and Release Area Calculator | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Generate changelog.md | |
run: | | |
make changelog > changelog.md | |
cat changelog.md | |
- name: Test | |
run: make test | |
- name: Build | |
run: make build | |
- name: Set binary path | |
run: | | |
binary_path=$(pwd)/bin/main | |
echo "BIN_PATH=${binary_path}" >> $GITHUB_ENV | |
- name: Create release | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref_name }} | |
run: | | |
gh release create area-${{ github.ref_name }}-x86_64 \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="${GITHUB_REPOSITORY#*/} ${tag#v}" \ | |
--notes-file changelog.md | |
- name: Upload Artifact | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref_name }} | |
run: | | |
gh release upload area-${{ github.ref_name }}-x86_64 ${{ env.BIN_PATH }} --clobber | |
# # s2i build and upload to quay | |
# - name: Install s2i | |
# run: | | |
# wget https://github.com/openshift/source-to-image/releases/download/v1.1.14/source-to-image-v1.1.14-874754de-linux-386.tar.gz | |
# tar -xvf source-to-image-v1.1.14-874754de-linux-386.tar.gz | |
# sudo mv s2i /usr/local/bin | |
# - name: Verify s2i version | |
# run: sudo s2i version | |
# - name: s2i-build | |
# run: | | |
# sudo s2i build . quay.io/rh-ee-kmemane/go-s2i-builder quay.io/rh-ee-kmemane/area-calculator | |
# sudo docker images | |
# - name: Push Application image to quay | |
# run: | | |
# sudo docker login quay.io -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" | |
# sudo docker push quay.io/rh-ee-kmemane/area-calculator |