Skip to content

ci: update release #144

ci: update release

ci: update release #144

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: [junowen-v*, junowen-server-v*]
pull_request:
branches: [main]
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.cargo/git
key: cargo-index-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
with:
path: target
key: cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Init Rust
shell: bash
run: |
rustup default nightly
rustup target add i686-pc-windows-msvc
cargo install cargo-bundle-licenses
- name: Build
shell: bash
run: |
cargo build --locked --release --workspace
cargo bundle-licenses --format yaml --output THIRDPARTY.yml
mkdir --parents artifact/modules
mv \
./target/i686-pc-windows-msvc/release/th19_*.dll \
./artifact/modules/
mv \
./target/i686-pc-windows-msvc/release/*.dll \
./target/i686-pc-windows-msvc/release/*.exe \
./artifact/
cp --recursive LICENSE README.md THIRDPARTY.yml ./artifact/
- uses: actions/upload-artifact@v3
with:
name: artifact-windows
path: ./artifact
release-windows:
needs: build-windows
if: startsWith(github.ref, 'refs/tags/junowen-v')
runs-on: ubuntu-latest
env:
FILENAME: ${{ github.ref_name }}.zip
steps:
- uses: actions/download-artifact@v3
with:
name: artifact-windows
path: ./artifact
- name: Zip
run: |
cd artifact
zip ../${{ env.FILENAME }} d3d9.dll modules/th19_junowen.dll LICENSE README.md THIRDPARTY.yml
ref_name=${{github.ref_name}}
echo "RELEASE_NAME=${ref_name/junowen-/Ju.N.Owen }" >> "$GITHUB_ENV"
- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ env.RELEASE_NAME }}
files: ${{ env.FILENAME }}
build-server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.cargo/git
key: cargo-index-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v3
with:
path: target
key: cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Init Rust
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
rustup default nightly
rustup target add x86_64-unknown-linux-gnu
pip3 install cargo-lambda
mkdir ~/.aws
cat <<EOF > ~/.aws/config
[default]
aws_access_key_id = $AWS_ACCESS_KEY_ID
aws_secret_access_key = $AWS_SECRET_ACCESS_KEY
region = ap-northeast-1
EOF
- name: Build & Deploy dev
run: |
cargo lambda build --locked --package junowen-server --release
cargo lambda deploy --binary-name junowen-server junowen-server-dev
- uses: actions/upload-artifact@v3
with:
name: artifact-server
path: ./target/lambda
release-server:
needs: build-server
if: startsWith(github.ref, 'refs/tags/junowen-server-v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: artifact-server
path: ./target/lambda
- name: Init Rust
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
pip3 install cargo-lambda
mkdir ~/.aws
cat <<EOF > ~/.aws/config
[default]
aws_access_key_id = $AWS_ACCESS_KEY_ID
aws_secret_access_key = $AWS_SECRET_ACCESS_KEY
region = ap-northeast-1
EOF
- name: Deploy
run: |
cargo lambda deploy --binary-name junowen-server junowen-server