Skip to content

Commit

Permalink
Merge pull request #10 from tamada/releases/v0.6.0
Browse files Browse the repository at this point in the history
Releases/v0.6.0
  • Loading branch information
tamada authored May 4, 2024
2 parents 6d92d32 + 8efa0e5 commit 6b1215e
Show file tree
Hide file tree
Showing 33 changed files with 852 additions and 233 deletions.
2 changes: 0 additions & 2 deletions .bin/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ for i in $(find .templates -type f)
do
update $i ${i#.templates/}
done

sed -e "s/^const VERSION = \".*\"$/const VERSION = \"${TO_VERSION}\"/g" cmd/version.go > a; mv a cmd/version.go
38 changes: 18 additions & 20 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,36 @@ on:
push:
branches:
- "**"

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest

# - windows-latest
- macos-latest
steps:
- name: setup go
uses: actions/setup-go@v4
with:
go-version: 1.21
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: checkout
uses: actions/checkout@v3
- name: Setup Rust LLVM coverage tools
run: |
rustup component add llvm-tools-preview
cargo install cargo-llvm-cov
- name: build
run: make
- name: Checkout the project
uses: actions/checkout@v4

- name: Convert coverage to lcov
uses: jandelgado/gcov2lcov-action@v1.0.0
with:
infile: coverage.out
outfile: coverage.lcov
if: matrix.os == 'ubuntu-latest'
- name: Test & Build
run: |
cargo llvm-cov --lcov --output-path coverage.lcov
cargo build
- name: coveralls
uses: coverallsapp/github-action@v2
- name: Send coverage to coveralls
uses: coverallsapp/github-action@master
if: matrix.os == 'ubuntu-latest'
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: coverage.lcov
if: matrix.os == 'ubuntu-latest'

122 changes: 106 additions & 16 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ on:
types: [closed]

jobs:
publish:
setup:
runs-on: ubuntu-latest
permissions:
contents: write # needs to push tags
if: startsWith(github.head_ref, 'releases/v') && github.event.pull_request.merged == true
outputs:
appname: gibo-wrapper
tag: ${{ steps.vars.outputs.tag }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
env:
REPO: https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0
uses: actions/checkout@v4

- name: Initialize
shell: bash
Expand All @@ -36,19 +35,110 @@ jobs:
HEAD_REF=${{ github.head_ref }}
echo "tag=${HEAD_REF##*/v}" >> $GITHUB_OUTPUT
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.21

- name: Push Tag
run: |
git tag -a v${{ steps.vars.outputs.tag }} -m "Release ${{ steps.vars.outputs.tag }}"
git push $REPO v${{ steps.vars.outputs.tag }}
- uses: goreleaser/goreleaser-action@v4
- name: Create release
id: create_release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: v${{ steps.vars.outputs.tag }}
title: Release v${{ steps.vars.outputs.tag }}
draft: false
prerelease: false

publish:
runs-on: ${{ matrix.os }}
needs: setup
strategy:
matrix:
include:
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_linux_amd64
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_linux_arm64
# - os: ubuntu-latest
# target: aarch64-pc-windows-gnullvm
# artifact_name: ${{ needs.setup.outputs.appname }}.exe
# asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_windows_amd64
# - os: ubuntu-latest
# target: x86_64-pc-windows-gnu
# artifact_name: ${{ needs.setup.outputs.appname }}.exe
# asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_windows_arm64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_darwin_amd64
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: ${{ needs.setup.outputs.appname }}
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_darwin_arm64
steps:
# initialization
- name: Checkout the project
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Setup variables
id: vars
shell: bash
run: |
DIR=$(echo "${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}")
echo "dir=$DIR" >> $GITHUB_OUTPUT
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Setup
run: rustup update stable

- name: Setup Rust (1/2) (toolchain)
uses: taiki-e/setup-cross-toolchain-action@v1
if: matrix.os == 'ubuntu-latest'
with:
args: release --clean
target: ${{ matrix.target }}

- name: Cross build (macOS)
if: matrix.os == 'macos-latest'
run: |
rustup target add ${{ matrix.target }}
cargo build --release --target ${{ matrix.target }}
- name: Cross build (Linux and Windows)
if: matrix.os == 'ubuntu-latest'
run: |
cargo build --release --target ${{ matrix.target }}
# publish release
- name: Create release file
shell: bash
run: |
DIR=${{ steps.vars.outputs.dir }}
DIST=${{ matrix.target }}
mkdir -p dist/$DIST/$DIR
# cp -r site/public dist/$DIST/$DIR/docs
cp -r README.md LICENSE target/completions target/${{ matrix.target }}/release/${{ matrix.artifact_name }} dist/$DIST/$DIR
tar cvfz dist/${{ matrix.asset_name }}.tar.gz -C dist/$DIST $DIR
- name: Upload release assets
id: upload-release-assets
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 自動で生成されるシークレット
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_path: dist/${{ matrix.asset_name }}.tar.gz
asset_name: ${{ matrix.asset_name }}.tar.gz
asset_content_type: application/x-gzip
upload_url: ${{ needs.setup.outputs.upload_url }}
17 changes: 6 additions & 11 deletions .github/workflows/versionup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: version Up
on:
push:
branches:
- 'releases/v[0-9]+.[0-9]+.[0-9]*'
- releases/v*

jobs:
versionup:
runs-on: ubuntu-latest
permissions:
contents: write # needs for push changes
steps:
- name: Get branches
id: vars
Expand All @@ -17,24 +15,21 @@ jobs:
echo "tag=${GITHUB_REF##**/v}" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ steps.vars.outputs.branch }}
fetch-depth: 0
uses: actions/checkout@v4

- name: Initialize
shell: bash
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "action@github.com"
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Version up
id: updating_version
run:
(bash ./.bin/update-version.sh ${{ steps.vars.outputs.tag }} && git commit -a -m "update version to ${{ steps.vars.outputs.tag }}, ready to publish v${{ steps.vars.outputs.tag }}") || true
run: |
sed "s/^version = \".*\"/version = \"${{ steps.vars.outputs.tag }}\"/" Cargo.toml > a ; mv a Cargo.toml
sed -e "s/\${VERSION}/${TO_VERSION}/g" -e "s/\${VERSION_DH}/${TO_VERSION//-/--}/g" .templates/README.md > README.md
git commit -a -m "update version to ${{ steps.vars.outputs.tag }}, ready to publish v${{ steps.vars.outputs.tag }}" || true
- name: Push branch
uses: ad-m/github-push-action@master
Expand Down
Loading

0 comments on commit 6b1215e

Please sign in to comment.