Skip to content

Commit

Permalink
Fix workflow not adding binary artifacts to release
Browse files Browse the repository at this point in the history
  • Loading branch information
Funami580 committed Sep 8, 2021
1 parent 5cae41f commit 6506297
Showing 1 changed file with 27 additions and 104 deletions.
131 changes: 27 additions & 104 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,93 +1,15 @@
name: Build binary
name: Build binaries

on:
push:
tags:
- 'v*'
release:
types: [published]

jobs:
release:
name: release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: create a github release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: htmlq ${{ github.ref }}
draft: true
prerelease: false

linux:
name: linux gnulibc build
runs-on: ubuntu-latest
needs: [release]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- run: cargo build --release
- run: tar cfz htmlq_x64_linux.tar.gz -C target/release htmlq
- name: upload x64 linux gnu release
id: release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{needs.release.outputs.upload_url}}
asset_path: ./htmlq_x64_linux.tar.gz
asset_name: htmlq_x64_linux.tar.gz
asset_content_type: application/gzip

darwin:
name: darwin
runs-on: macos-latest
needs: [release]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- run: cargo build --release
- run: tar cfz htmlq_x64_darwin.tar.gz -C target/release htmlq
- name: upload darwin release
id: release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{needs.release.outputs.upload_url}}
asset_path: ./htmlq_x64_darwin.tar.gz
asset_name: htmlq_x64_darwin.tar.gz
asset_content_type: application/gzip

windows:
name: windows
runs-on: windows-latest
needs: [release]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand All @@ -96,24 +18,25 @@ jobs:
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- run: cargo build --release
- name: tar it up
- name: Build release
run: cargo build --release
- name: Archive as .tar.gz (Linux)
if: matrix.os == 'ubuntu-latest'
run: tar cfz htmlq-x86_64-linux.tar.gz -C target/release htmlq
- name: Archive as .tar.gz (macOS)
if: matrix.os == 'macos-latest'
run: tar cfz htmlq-x86_64-darwin.tar.gz -C target/release htmlq
- name: Archive as .tar.gz (Windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
tar cfz htmlq_x64_win32.tar.gz -C target/release htmlq
- name: upload windows release
id: release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: tar cfz htmlq-x86_64-windows.tar.gz -C target/release htmlq.exe
- name: Publish
uses: softprops/action-gh-release@v1
with:
upload_url: ${{needs.release.outputs.upload_url}}
asset_path: ./htmlq_x64_win32.tar.gz
asset_name: htmlq_x64_win32.tar.gz
asset_content_type: application/gzip
files: htmlq*.tar.gz

0 comments on commit 6506297

Please sign in to comment.