Merge pull request #6525 from planetarium/feature/fix-thor-schedule-n… #14647
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: Build and Release | |
on: | |
push: | |
branches: | |
- main | |
- development | |
- preview | |
- release/* | |
- fast-track/* | |
tags: [ "*" ] | |
pull_request: | |
types: [ ready_for_review, opened, reopened, auto_merge_enabled ] | |
workflow_dispatch: | |
inputs: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} | |
jobs: | |
build: | |
name: Build for ${{ matrix.targetPlatform }} | |
runs-on: | |
group: linux-8cores | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
projectPath: | |
- nekoyume | |
targetPlatform: | |
- StandaloneWindows | |
- StandaloneLinux64 | |
- StandaloneOSX | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
submodules: true | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ matrix.projectPath }}/Library | |
key: Library-${{ matrix.projectPath }}-ubuntu-${{ matrix.targetPlatform }} | |
restore-keys: | | |
Library-${{ matrix.projectPath }}-ubuntu- | |
Library- | |
- uses: game-ci/unity-builder@v4 | |
with: | |
projectPath: ${{ matrix.projectPath }} | |
targetPlatform: ${{ matrix.targetPlatform }} | |
buildMethod: 'Editor.Builder.Build${{ matrix.targetPlatform }}' | |
buildName: ${{ matrix.targetPlatform }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11.0 | |
- name: Move Folder | |
run: | | |
sudo mv $GITHUB_WORKSPACE/build /tmp/player | |
- name: Pack | |
run: | | |
targetPlatform=${{ matrix.targetPlatform }} | |
pip3 install wheel | |
sudo bash .github/bin/pack.sh \ | |
/tmp/packages \ | |
"${{ matrix.targetPlatform }}" \ | |
"/tmp/player" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Build-${{ matrix.targetPlatform }} | |
path: /tmp/packages | |
retention-days: 7 | |
if-no-files-found: error | |
extract: | |
if: (startsWith(github.ref, 'refs/heads/release/') | |
|| github.ref == 'refs/heads/preview' | |
|| startsWith(github.event.ref, 'refs/tags/') | |
) | |
needs: build | |
runs-on: ubuntu-latest | |
outputs: | |
network: ${{ steps.extract.outputs.network }} | |
signing: ${{ steps.extract.outputs.signing }} | |
version: ${{ steps.extract.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: extract | |
id: extract | |
run: | | |
timestamp=$(date +%s) | |
major=${timestamp:0:4} | |
minor=${timestamp:4:3} | |
patch=${timestamp:7:3} | |
semver="${major}.${minor}.${patch}" | |
if [[ "${{ startsWith(github.ref, 'refs/heads/release/') }}" == "true" ]]; then | |
echo "::set-output name=network::internal" | |
echo "::set-output name=signing::--no-signing" | |
echo "::set-output name=version::$semver" | |
elif [[ "${{ github.ref == 'refs/heads/preview' }}" == "true" ]]; then | |
echo "::set-output name=network::preview" | |
echo "::set-output name=signing::--no-signing" | |
echo "::set-output name=version::$semver" | |
elif [[ "${{ startsWith(github.event.ref, 'refs/tags/') }}" == "true" ]]; then | |
TAG_NAME=${GITHUB_REF#refs/tags/} | |
echo "::set-output name=network::main" | |
echo "::set-output name=signing::--signing" | |
echo "::set-output name=version::$TAG_NAME" | |
else | |
echo "::set-output name=network::null" | |
echo "::set-output name=signing::null" | |
echo "::set-output name=version::null" | |
fi | |
release: | |
if: (startsWith(github.ref, 'refs/heads/release/') | |
|| github.ref == 'refs/heads/preview' | |
|| startsWith(github.event.ref, 'refs/tags/') | |
) | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
targetPlatform: | |
- Windows | |
- macOS | |
- Linux | |
needs: extract | |
environment: | |
name: ${{ needs.extract.outputs.network }} | |
permissions: | |
id-token: write | |
contents: read | |
outputs: | |
version: ${{ needs.extract.outputs.version }} | |
network: ${{ needs.extract.outputs.network }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ROLE_TO_ASSUME }} | |
role-session-name: GitHubActions-${{ github.run_id }} | |
role-duration-seconds: 1200 | |
aws-region: ap-northeast-2 | |
- name: release | |
uses: planetarium/9c-toolbelt@main | |
with: | |
COMMAND_LIST: "release|player|${{ github.sha }}|${{ needs.extract.outputs.version }}|${{ needs.extract.outputs.network }}|${{ matrix.targetPlatform }}|${{ needs.extract.outputs.signing }}|--slack-channel=${{ secrets.SLACK_CHANNEL }}|--run-id=${{ github.run_id }}" | |
ENV: production | |
GITHUB_TOKEN: ${{ secrets.P_GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }} | |
NAVER_CLOUD_ACCESS_KEY: ${{ secrets.NAVER_CLOUD_ACCESS_KEY }} | |
NAVER_CLOUD_SECRET_KEY: ${{ secrets.NAVER_CLOUD_SECRET_KEY }} | |
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} | |
ESIGNER_CREDENTIAL_ID: ${{ secrets.ESIGNER_CREDENTIAL_ID }} | |
ESIGNER_USERNAME: ${{ secrets.ESIGNER_USERNAME }} | |
ESIGNER_PASSWORD: ${{ secrets.ESIGNER_PASSWORD }} | |
ESIGNER_TOTP_SECRET: ${{ secrets.ESIGNER_TOTP_SECRET }} | |
update-latest-metadata: | |
if: (startsWith(github.ref, 'refs/heads/release/') | |
|| github.ref == 'refs/heads/preview' | |
|| startsWith(github.event.ref, 'refs/tags/') | |
) | |
runs-on: ubuntu-20.04 | |
needs: [ extract, release ] | |
environment: | |
name: ${{ needs.extract.outputs.network }} | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ROLE_TO_ASSUME }} | |
role-session-name: GitHubActions-${{ github.run_id }} | |
role-duration-seconds: 1200 | |
aws-region: ap-northeast-2 | |
- name: update-latest-metadata | |
uses: planetarium/9c-toolbelt@main | |
with: | |
COMMAND_LIST: "release|update-latest|${{ github.sha }}|${{ needs.extract.outputs.version }}|${{ needs.extract.outputs.network }}|--slack-channel=${{ secrets.SLACK_CHANNEL }}" | |
ENV: production | |
GITHUB_TOKEN: ${{ secrets.P_GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }} | |
NAVER_CLOUD_ACCESS_KEY: ${{ secrets.NAVER_CLOUD_ACCESS_KEY }} | |
NAVER_CLOUD_SECRET_KEY: ${{ secrets.NAVER_CLOUD_SECRET_KEY }} | |
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} |