Skip to content

Commit

Permalink
fix: ビルドスクリプトのバグ修正とバージョン管理の改善
Browse files Browse the repository at this point in the history
  • Loading branch information
cffnpwr committed Jul 2, 2024
1 parent 8962689 commit f6156f8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_call:
inputs:
version:
required: false
required: true
type: string

jobs:
Expand Down Expand Up @@ -108,39 +108,34 @@ jobs:
- name: Build
run: cargo build --release --target ${{ matrix.job.target }}

- id: date
env:
TZ: "Asia/Tokyo"
run: echo "date=unstable-$(date -u +'%Y%m%d')" >> $GITHUB_OUTPUT

- name: tar archive
id: tar
if: ${{ !contains(matrix.job.target, 'windows') }}
run: |
FILENAME=snails-machine-${{ inputs.version || steps.date.outputs.date }}-${{ matrix.job.target }}.tar.gz
FILENAME=snails-machine-${{ inputs.version }}-${{ matrix.job.target }}.tar.gz
tar czf ${FILENAME} -C target/${{ matrix.job.target }}/release snails-machine
echo "filename=${FILENAME}" >> $GITHUB_OUTPUT
- name: zip archive
id: zip
if: contains(matrix.job.target, 'windows')
run: |
$env:FILENAME="snails-machine-${{ inputs.version || steps.date.outputs.date }}-${{ matrix.job.target }}.zip"
Compress-Archive -Path .\\target\\${{ matrix.job.target }}\\release\\snails-machine.exe -DestinationPath $env:FILENAME
$env:FILENAME="snails-machine-${{ inputs.version }}-${{ matrix.job.target }}.zip"
Compress-Archive .\\target\\${{ matrix.job.target }}\\release\\snails-machine.exe $env:FILENAME
echo "filename=${FILENAME}" >> $env:GITHUB_OUTPUT
- name: Save tar artifact
if: ${{ !contains(matrix.job.target, 'windows') }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.version || steps.date.outputs.date }}-${{ matrix.job.target }}
name: ${{ inputs.version }}-${{ matrix.job.target }}
path: ./${{ steps.tar.outputs.filename }}

- name: Save zip artifact
if: contains(matrix.job.target, 'windows')
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.version || steps.date.outputs.date }}-${{ matrix.job.target }}
name: ${{ inputs.version }}-${{ matrix.job.target }}
path: ./${{ steps.zip.outputs.filename }}


Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ jobs:
- name: Run Test
run: cargo test

version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.date.outputs.date }}
steps:
- id: date
env:
TZ: "Asia/Tokyo"
run: echo "date=unstable-$(date -u +'%Y%m%d')" >> $GITHUB_OUTPUT

unstable-build:
needs: version
uses: ./.github/workflows/build.yaml
with:
version: ${{ needs.version.outputs.version }}

0 comments on commit f6156f8

Please sign in to comment.