fix CI errors of invalid reference of upload_url #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish_site_release_assets | |
on: | |
pull_request: | |
branches: | |
- main | |
types: [closed] | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
# ブランチ名が release/v から始まる場合のみに実行する. | |
# プルリクエストがマージされた場合のみに実行する. | |
if: startsWith(github.head_ref, 'release/v') && github.event.pull_request.merged == true | |
outputs: | |
appname: totebag | |
tag: ${{ steps.vars.outputs.tag }} | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Git Tag name | |
id: vars | |
run: | | |
echo "GITHUB_HEAD_REF: $GITHUB_HEAD_REF (${GITHUB_HEAD_REF##*/v})" | |
echo "tag=${GITHUB_HEAD_REF##*/v}" >> $GITHUB_OUTPUT | |
- 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: x86_64-unknown-linux-gnu | |
artifact_name: ${{ needs.setup.outputs.appname }} | |
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_linux_amd64 | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
artifact_name: ${{ needs.setup.outputs.appname }} | |
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_linux_arm64 | |
- os: ubuntu-latest | |
target: x86_64-apple-darwin | |
artifact_name: ${{ needs.setup.outputs.appname }} | |
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_darwin_amd64 | |
- os: ubuntu-latest | |
target: aarch64-apple-darwin | |
artifact_name: ${{ needs.setup.outputs.appname }} | |
asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_darwin_arm64 | |
# - os: ubuntu-latest | |
# target: x86_64-pc-windows-msvc | |
# artifact_name: ${{ needs.setup.outputs.appname }}.exe | |
# asset_name: ${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}_windows_amd64 | |
# - os: ubuntu-latest | |
# target: aarch64-pc-windows-msvc | |
# artifact_name: btmeister.exe | |
# asset_name: btmeister-${{ needs.setup.outputs.tag }}_windows_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 Rust (1/2) | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- name: Setup Rust (2/2) | |
run: | | |
cargo install cross | |
- name: Setup variables | |
id: vars | |
shell: bash | |
run: | | |
DIR=$(echo "${{ needs.setup.outputs.appname }}-${{ needs.setup.outputs.tag }}") | |
echo "dir=$DIR" >> $GITHUB_OUTPUT | |
- name: Cross build with all features | |
run: | | |
cross 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/[email protected] | |
env: | |
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 }} |