Change where .env is defined #45
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: Build and Release (on GitHub only) | |
on: | |
# when a push is made to the main branch (like when a pull request is merged, or something is pushed directly) | |
workflow_dispatch: | |
push: | |
branches: [ "main", "pr/adisidev/201" ] | |
env: | |
BUILD_TYPE: Release | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
container: | |
image: gocartio/cartogram-web:latest | |
steps: | |
- name: Install Dependencies | |
run: | | |
apt update -y | |
apt install -y git g++-11 build-essential cmake libboost-all-dev | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
fetch-depth: 0 | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build | |
run: | | |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target install -j$(nproc) -- | |
# - name: Run CTest | |
# working-directory: ${{github.workspace}}/build | |
# # Execute tests defined by the CMake configuration. | |
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
# run: ctest -C ${{env.BUILD_TYPE}} | |
# - name: Run Stress Test | |
# run: | | |
# sudo make install -C build | |
# cd tests/ | |
# chmod +x stress_test.sh | |
# bash stress_test.sh | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cartogram | |
path: /usr/local/bin/cartogram | |
- name: Generate and Push Tag | |
id: generate_tag | |
run: | | |
pwd | |
ls -la | |
# Configure git committer | |
git config user.email "action@github.com" | |
git config user.name "GitHub Action" | |
# # t the current date | |
current_date=$(date +'%Y-%m-%d') | |
# Get the short SHA of the current HEAD | |
short_sha=$(git rev-parse --short HEAD) | |
# Create the new tag | |
git tag -a "${short_sha}" -m "New release on ${current_date}" | |
# Push the tag to the repository | |
git push origin "${short_sha}" | |
echo "new_tag=${short_sha}" >> $GITHUB_OUTPUT | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.generate_tag.outputs.new_tag }} | |
files: build/bin/cartogram | |
body: "Rolling release ${{ steps.generate_tag.outputs.release_number }}" |