Skip to content

Merge pull request #6 from Eric-Jalal/develop #10

Merge pull request #6 from Eric-Jalal/develop

Merge pull request #6 from Eric-Jalal/develop #10

Workflow file for this run

name: Generate Release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Some programmers use env matrix but this case it is just two repeated variable and I decided to keep it simple
- name: Set up compiler
run: |
sudo apt-get update
sudo apt-get install -y gcc-10 g++-10
- name: Build release version
env:
CC: gcc-10
CXX: g++-10
run: |
sudo apt-get install -y cmake
cmake . && make
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
build-args: GIT_COMMIT=${{ github.sha }}
tags: jerilok/cpp-build-test:latest
# This is an unofficial action and could be internilized and be recreated due to security reasons in enterprise companies.
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
artifacts: "main"