Skip to content

Commit fd56b6e

Browse files
committed
Add workflow_dispatch trigger to all CI workflows
1 parent c63909e commit fd56b6e

File tree

6 files changed

+139
-15
lines changed

6 files changed

+139
-15
lines changed

.github/workflows/ci-catcsv.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ name: CI for catcsv
33
# Controls when the action will run. Triggers the workflow on push or pull request
44
# events but only for the master branch
55
on:
6-
create:
7-
tags:
8-
- "catcsv_*"
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- "build-release"
12+
- ".github/workflows/ci-catcsv.yml"
13+
- "catcsv/**"
914
pull_request:
1015
# Only run on pull requests against the main branch.
1116
branches: [main]

.github/workflows/ci-fixed2csv.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ name: CI for fixed2csv
33
# Controls when the action will run. Triggers the workflow on push or pull request
44
# events but only for the master branch
55
on:
6-
create:
7-
tags:
8-
- "fixed2csv_*"
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- "build-release"
12+
- ".github/workflows/ci-fixed2csv.yml"
13+
- "fixed2csv/**"
914
pull_request:
1015
# Only run on pull requests against the main branch.
1116
branches: [main]

.github/workflows/ci-geochunk.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ name: CI for geochunk
33
# Controls when the action will run. Triggers the workflow on push or pull request
44
# events but only for the master branch
55
on:
6-
create:
7-
tags:
8-
- "geochunk_*"
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- "build-release"
12+
- ".github/workflows/ci-geochunk.yml"
13+
- "geochunk/**"
914
pull_request:
1015
# Only run on pull requests against the main branch.
1116
branches: [main]

.github/workflows/ci-hashcsv.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ name: CI for hashcsv
33
# Controls when the action will run. Triggers the workflow on push or pull request
44
# events but only for the master branch
55
on:
6-
create:
7-
tags:
8-
- "hashcsv_*"
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- "build-release"
12+
- ".github/workflows/ci-hashcsv.yml"
13+
- "hashcsv/**"
914
pull_request:
1015
# Only run on pull requests against the main branch.
1116
branches: [main]

.github/workflows/ci-scrubcsv.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ name: CI for scrubcsv
33
# Controls when the action will run. Triggers the workflow on push or pull request
44
# events but only for the master branch
55
on:
6-
create:
7-
tags:
8-
- "scrubcsv_*"
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- "build-release"
12+
- ".github/workflows/ci-scrubcsv.yml"
13+
- "scrubcsv/**"
914
pull_request:
1015
# Only run on pull requests against the main branch.
1116
branches: [main]
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Release catcsv
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version to release (e.g., 1.0.1)"
8+
required: true
9+
type: string
10+
11+
jobs:
12+
create_release:
13+
name: Create GitHub release
14+
runs-on: ubuntu-latest
15+
outputs:
16+
upload_url: ${{ steps.create_release.outputs.upload_url }}
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Create tag
21+
run: |
22+
git config user.name "GitHub Actions"
23+
git config user.email "actions@github.com"
24+
git tag catcsv_v${{ inputs.version }}
25+
git push origin catcsv_v${{ inputs.version }}
26+
27+
- name: Extract release body from CHANGELOG.md
28+
id: extract_release_body
29+
run: |
30+
curl -sLO https://github.com/marcaddeo/clparse/releases/download/0.8.0/clparse-0.8.0-x86_64-unknown-linux-musl.tar.gz
31+
tar xzf clparse*.tar.gz
32+
sudo cp clparse /usr/local/bin
33+
rm -rf clparse*
34+
clparse -f json catcsv/CHANGELOG.md | \
35+
jq ".releases[] | select(.version == \"${{ inputs.version }}\") | { title: \"\", description: \"\", releases: [.] }" | \
36+
clparse - | \
37+
tail -n +3 > RELEASE_BODY.md
38+
39+
- name: Create release
40+
id: create_release
41+
uses: actions/create-release@v1
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
with:
45+
tag_name: catcsv_v${{ inputs.version }}
46+
release_name: "catcsv ${{ inputs.version }}"
47+
body_path: RELEASE_BODY.md
48+
49+
build:
50+
name: Build and upload binaries
51+
needs: create_release
52+
strategy:
53+
matrix:
54+
include:
55+
- target: x86_64-unknown-linux-musl
56+
host: x86_64-unknown-linux-musl
57+
cargo: cross
58+
os: ubuntu-latest
59+
- target: x86_64-apple-darwin
60+
host: x86_64-apple-darwin
61+
cargo: cargo
62+
os: macos-latest
63+
- target: aarch64-apple-darwin
64+
host: x86_64-apple-darwin
65+
cargo: cargo
66+
os: macos-latest
67+
- target: x86_64-pc-windows-gnu
68+
host: x86_64-unknown-linux-musl
69+
cargo: cross
70+
os: ubuntu-latest
71+
72+
runs-on: ${{ matrix.os }}
73+
74+
steps:
75+
- name: Install Rust toolchain
76+
uses: actions-rs/toolchain@v1
77+
with:
78+
profile: minimal
79+
toolchain: stable
80+
components: rustfmt, clippy
81+
target: ${{ matrix.target }}
82+
83+
- uses: actions/checkout@v2
84+
85+
- name: Build release
86+
working-directory: .
87+
run: |
88+
export RELEASE_VERSION="${{ inputs.version }}"
89+
./build-release catcsv ${{ matrix.target }} ${{ matrix.host }} ${{ matrix.cargo }}
90+
91+
- name: Upload Release Asset
92+
uses: actions/upload-release-asset@v1
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
with:
96+
upload_url: ${{ needs.create_release.outputs.upload_url }}
97+
asset_path: ./catcsv_v${{ inputs.version }}_${{ matrix.target }}.zip
98+
asset_name: catcsv_v${{ inputs.version }}_${{ matrix.target }}.zip
99+
asset_content_type: application/zip

0 commit comments

Comments
 (0)