Skip to content

Commit

Permalink
CI: Merge release into build.
Browse files Browse the repository at this point in the history
  • Loading branch information
heiher committed May 12, 2024
1 parent 9b7cb52 commit c0d9fe9
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 90 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,43 @@ name: "Build"

on:
push:
branches:
- '**'
pull_request:
release:
types:
- published

jobs:
source:
name: Source
runs-on: ubuntu-20.04
if: github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
submodules: true
- name: Gen Source
run: |
REV_ID=$(git tag --points-at HEAD)
if [ -z "${REV_ID}" ]; then
REV_ID=$(git rev-parse --short HEAD)
fi
mkdir -p natmap-${{ github.ref_name }}
git ls-files --recurse-submodules | tar c -O -T- | tar x -C natmap-${{ github.ref_name }}
echo ${REV_ID} > natmap-${{ github.ref_name }}/.version
tar caf natmap-${{ github.ref_name }}.tar.gz natmap-${{ github.ref_name }}
- name: Upload source
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: natmap-${{ github.ref_name }}.tar.gz
asset_name: natmap-${{ github.ref_name }}.tar.gz
asset_content_type: application/octet-stream
linux:
name: Linux
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -49,9 +83,20 @@ jobs:
wget https://github.com/musl-cross/musl-cross/releases/download/20240317/${{ matrix.tool }}.tgz
sudo tar xf ${{ matrix.tool }}.tgz -C /opt/x-tools
make CROSS_PREFIX=/opt/x-tools/${{ matrix.tool }}/bin/${{ matrix.tool }}- CFLAGS=${{ matrix.env.CFLAGS }} ENABLE_STATIC=1 -j`nproc`
- name: Upload ${{ matrix.name }}
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: bin/natmap
asset_name: natmap-linux-${{ matrix.name }}
asset_content_type: application/octet-stream
macos:
name: macOS
runs-on: macos-14
if: github.event_name != 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
90 changes: 0 additions & 90 deletions .github/workflows/release.yaml

This file was deleted.

0 comments on commit c0d9fe9

Please sign in to comment.