diff --git a/.github/workflows/binary_artifact.yml b/.github/workflows/binary_artifact.yml index aed7631126..2893f29fe9 100644 --- a/.github/workflows/binary_artifact.yml +++ b/.github/workflows/binary_artifact.yml @@ -1,140 +1,148 @@ name: Build binary artifacts on: - push: - branches: - - main - - master + push: + tags: + - weekly.** jobs: - build-linux: - runs-on: ubuntu-latest - timeout-minutes: 30 - env: - CC: gcc - steps: - - uses: actions/checkout@v1 - - name: Compile - run: make -## - name: Create artifact -## uses: actions/upload-artifact@v2 -## with: -## name: linux -## path: | -## . -## !./.git -## !./.ctags.d -## !./.github -## !./vc -## !./v_old -## - name: Create binary only artifact -## uses: actions/upload-artifact@v2 -## with: -## name: linux-binary -## path: ./v -## -## build-macos: -## runs-on: macos-latest -## env: -## CC: clang -## steps: -## - uses: actions/checkout@v1 -## - name: Compile -## run: make -## - name: Create artifact -## uses: actions/upload-artifact@v2 -## with: -## name: macos -## path: | -## . -## !./.git -## !./.ctags.d -## !./.github -## !./vc -## !./v_old -## - name: Create binary only artifact -## uses: actions/upload-artifact@v2 -## with: -## name: macos-binary -## path: ./v -## -## build-windows: -## runs-on: windows-latest -## -## steps: -## - uses: actions/checkout@v1 -## - uses: msys2/setup-msys2@v2 -## - name: Compile -## run: ./make.bat -## - name: Create artifact -## uses: actions/upload-artifact@v2 -## with: -## name: windows -## path: | -## . -## !./.git -## !./.ctags.d -## !./.github -## !./vc -## !./v_old -## - name: Create binary only artifact -## uses: actions/upload-artifact@v2 -## with: -## name: windows-binary -## path: ./v.exe -## -## release: -## name: Create Github Release -## needs: [build-linux, build-windows, build-macos] -## runs-on: ubuntu-latest -## steps: -## - name: Remove old tag -## uses: dev-drprasad/delete-tag-and-release@v0.1.2 -## with: -## delete_release: true -## tag_name: latest-commit -## env: -## GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -## - name: Create Release -## id: create_release -## uses: ncipollo/release-action@v1 -## with: -## token: ${{ secrets.GITHUB_TOKEN }} -## tag: latest-commit -## name: Prebuilt binaries of the latest commit -## commit: ${{ github.sha }} -## draft: false -## prerelease: true -## -## publish: -## needs: [release] -## runs-on: ubuntu-latest -## strategy: -## matrix: -## version: [linux, macos, windows] -## steps: -## - uses: actions/checkout@v1 -## - name: Fetch artifacts -## uses: actions/download-artifact@v1 -## with: -## name: ${{ matrix.version }} -## path: ./${{ matrix.version }} -## - name: Build -## run: zip -r ${{ matrix.version }}.zip ./${{ matrix.version }}/* -## - name: Get release -## id: get_release_info -## uses: leahlundqvist/get-release@v1.3.1 -## env: -## GITHUB_TOKEN: ${{ github.token }} -## with: -## tag_name: latest-commit -## - name: Upload Release Asset -## id: upload-release-asset -## uses: actions/upload-release-asset@v1.0.1 -## env: -## GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -## with: -## upload_url: ${{ steps.get_release_info.outputs.upload_url }} -## asset_path: ./${{ matrix.version }}.zip -## asset_name: ${{ matrix.version }}.zip -## asset_content_type: application/zip + build-linux: + runs-on: ubuntu-latest + strategy: + matrix: + compiler: [gcc] + steps: + - uses: actions/checkout@v1 + - name: Compile + env: + CC: ${{ matrix.compiler }} + run: make + - name: Create artifact + uses: actions/upload-artifact@v2 + with: + name: linux + path: | + . + !./.git + !./.ctags.d + !./.github + !./vc + !./v_old + - name: Create binary only artifact + uses: actions/upload-artifact@v2 + with: + name: linux-binary + path: ./v + + build-macos: + runs-on: macos-latest + strategy: + matrix: + compiler: [clang] + steps: + - uses: actions/checkout@v1 + - name: Compile + env: + CC: ${{ matrix.compiler }} + run: make + - name: Create artifact + uses: actions/upload-artifact@v2 + with: + name: macos + path: | + . + !./.git + !./.ctags.d + !./.github + !./vc + !./v_old + - name: Create binary only artifact + uses: actions/upload-artifact@v2 + with: + name: macos-binary + path: ./v + + build-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + - uses: msys2/setup-msys2@v2 + - name: Compile + run: ./make.bat + - name: Create artifact + uses: actions/upload-artifact@v2 + with: + name: windows + path: | + . + !./.git + !./.ctags.d + !./.github + !./vc + !./v_old + - name: Create binary only artifact + uses: actions/upload-artifact@v2 + with: + name: windows-binary + path: ./v.exe + + release: + name: Create Github Release + needs: [build-linux, build-windows, build-macos] + runs-on: ubuntu-latest + steps: + - name: Get short tag name + uses: jungwinter/split@v1 + id: split + with: + msg: ${{ github.ref }} + seperator: / + - name: Create Release + id: create_release + uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ steps.split.outputs._2 }} + name: ${{ steps.split.outputs._2 }} + commit: ${{ github.sha }} + draft: false + prerelease: false + + publish: + needs: [release] + runs-on: ubuntu-latest + strategy: + matrix: + version: [linux, macos, windows] + steps: + - uses: actions/checkout@v1 + - name: Fetch artifacts + uses: actions/download-artifact@v1 + with: + name: ${{ matrix.version }} + path: ./${{ matrix.version }} + - name: Build + run: zip -r ${{ matrix.version }}.zip ./${{ matrix.version }}/* + - name: Get short tag name + uses: jungwinter/split@v1 + id: split + with: + msg: ${{ github.ref }} + seperator: / + - name: Get release + id: get_release_info + uses: leahlundqvist/get-release@v1.3.1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + tag_name: ${{ steps.split.outputs._2 }} + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release_info.outputs.upload_url }} + asset_path: ./${{ matrix.version }}.zip + asset_name: ${{ matrix.version }}.zip + asset_content_type: application/zip \ No newline at end of file