Skip to content

update pipeline

update pipeline #14

name: Build and Release
on: push
jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
# - windows-latest
include:
- os: ubuntu-latest
image: ubuntu:latest
- os: macos-latest
image: macos-latest
#- os: windows-latest
#image: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build on Linux and macOS
if: matrix.os != 'windows-latest'
run: |
gcc await.c -o await -lpthread
- name: Build on Windows
if: matrix.os == 'windows-latest'
run: |
gcc await.c -o await.exe -lpthread
- name: Create release directory
run: mkdir -p releases
- name: Move binary to release directory
run: |
if [ ${{ matrix.os }} == 'windows-latest' ]; then
mv await.exe releases/await_${{ github.ref_name }}_windows_amd64.exe
elif [ ${{ matrix.os }} == 'macos-latest' ]; then
mv await releases/await_${{ github.ref_name }}_macos_amd64
else
mv await releases/await_${{ github.ref_name }}_linux_amd64
fi
- name: Set dummy ACTIONS_RUNTIME_TOKEN and ACTIONS_RUNTIME_URL for act
if: ${{ env.ACT }}
run: |
echo "ACTIONS_RUNTIME_TOKEN=dummy_token" >> $GITHUB_ENV
echo "ACTIONS_RUNTIME_URL=https://dummy_url" >> $GITHUB_ENV
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: v1.0
release_name: await v1.0
body: CI/CD for mac/linux
draft: false
prerelease: false
- name: Upload Artifact
uses: softprops/action-gh-release@v1
with:
files: releases/*
tag_name: v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}