Update README.md #105
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: C/C++ CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
bump-tag-dry: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get next version | |
id: tag | |
uses: anothrNick/github-tag-action@1.36.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: true | |
DEFAULT_BUMP: patch | |
DRY_RUN: true | |
- name: create tag file | |
run: | | |
echo ${{ steps.tag.outputs.new_tag }} > tag.txt | |
- name: upload new tag artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: uploads | |
path: tag.txt | |
build-linux: | |
runs-on: ubuntu-latest | |
needs: [bump-tag-dry] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: download artifacts | |
uses: actions/download-artifact@v1 | |
with: | |
name: uploads | |
- name: build | |
run: | | |
sudo npm install -g bats | |
export DUPLO_VERSION=`cat ./uploads/tag.txt` | |
mkdir -p build | |
pushd build | |
cmake .. -DDUPLO_VERSION=\"$DUPLO_VERSION\" | |
popd | |
./compile.sh | |
zip --junk-paths duplo-linux build/duplo | |
- name: upload linux artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: uploads | |
path: duplo-linux.zip | |
build-macos: | |
runs-on: macos-latest | |
needs: [bump-tag-dry] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: download artifacts | |
uses: actions/download-artifact@v1 | |
with: | |
name: uploads | |
- name: build | |
run: | | |
brew install bats-core | |
export DUPLO_VERSION=`cat ./uploads/tag.txt` | |
mkdir -p build | |
pushd build | |
cmake .. -DDUPLO_VERSION=\"$DUPLO_VERSION\" | |
popd | |
./compile.sh | |
zip --junk-paths duplo-macos build/duplo | |
- name: upload macos artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: uploads | |
path: duplo-macos.zip | |
push-docker-image: | |
runs-on: ubuntu-latest | |
needs: [bump-tag-dry] | |
steps: | |
- name: download artifacts | |
uses: actions/download-artifact@v1 | |
with: | |
name: uploads | |
- name: set version | |
run: echo "{DUPLO_VERSION}={$(cat ./uploads/tag.txt)}" >> $GITHUB_ENV | |
- name: print version | |
run: echo $DUPLO_VERSION | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: '0' | |
- uses: docker/build-push-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: dlidstrom/duplo | |
tag_with_ref: true | |
# push: ${{ startsWith(github.ref, 'refs/tags/') }} | |
build_args: DUPLO_VERSION=${{ env.DUPLO_VERSION }} | |
tags: ${{ env.DUPLO_VERSION }} | |
upload-release: | |
if: success() | |
runs-on: ubuntu-latest | |
needs: [build-linux, build-macos] | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: '0' | |
- name: Bump version and push tag | |
id: tag | |
uses: anothrNick/github-tag-action@1.36.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: true | |
DEFAULT_BUMP: patch | |
- name: create release | |
id: create_release | |
uses: actions/create-release@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag.outputs.tag }} | |
release_name: Release ${{ steps.tag.outputs.tag }} | |
draft: false | |
prerelease: false | |
- name: download artifacts | |
uses: actions/download-artifact@v1 | |
with: | |
name: uploads | |
- name: upload macos | |
id: upload-macos | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./uploads/duplo-macos.zip | |
asset_name: duplo-macos.zip | |
asset_content_type: application/zip | |
- name: upload linux | |
id: upload-linux | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./uploads/duplo-linux.zip | |
asset_name: duplo-linux.zip | |
asset_content_type: application/zip |