Merge pull request #146 from demotomohiro/add-nim-2.2.2 #100
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: Node | |
on: | |
push: | |
env: | |
ASSETS_URL: "https://api.github.com/repos/melpon/wandbox-builder/releases/178117233/assets" | |
UPLOAD_URL: "https://uploads.github.com/repos/melpon/wandbox-builder/releases/178117233/assets{?name,label}" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
_asset: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- run: | | |
pip3 install requests | |
python3 get_asset_info.py ${{ env.ASSETS_URL }} --github_token ${{ env.GITHUB_TOKEN }} > asset_info.json | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: asset_info.json | |
path: asset_info.json | |
nodejs: | |
needs: [_asset] | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
- 20.17.0 | |
- 18.20.4 | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/build-compiler | |
with: | |
name: ${{ github.job }} | |
version: ${{ matrix.version }} | |
upload_url: ${{ env.UPLOAD_URL }} | |
typescript: | |
needs: [_asset, nodejs] | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
- 5.6.2 nodejs 20.17.0 | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/build-compiler | |
with: | |
name: ${{ github.job }} | |
version: ${{ matrix.version }} | |
upload_url: ${{ env.UPLOAD_URL }} | |
_deploy: | |
needs: | |
- nodejs | |
- typescript | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
# SSH 秘密鍵の登録 | |
- name: Register SSH key | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
run: | | |
mkdir -p $HOME/.ssh | |
echo "$SSH_PRIVATE_KEY" > $HOME/.ssh/id_ed25519 | |
chmod 600 $HOME/.ssh/id_ed25519 | |
# デプロイ先を設定する | |
- name: Add SSH config | |
env: | |
SSH_HOST: ${{ secrets.SSH_HOST_UBUNTU_24_04 }} | |
SSH_USER: ${{ secrets.SSH_USER }} | |
run: | | |
echo "Host wandbox-ubuntu-24.04" >> $HOME/.ssh/config | |
echo " HostName $SSH_HOST" >> $HOME/.ssh/config | |
echo " User $SSH_USER" >> $HOME/.ssh/config | |
echo " ServerAliveInterval 60" >> $HOME/.ssh/config | |
echo " TCPKeepAlive yes" >> $HOME/.ssh/config | |
ssh-keyscan -H $SSH_HOST >> $HOME/.ssh/known_hosts | |
# ソースをデプロイ先にコピーして、デプロイスクリプトを実行する | |
- id: deploy | |
name: Deploy | |
run: | | |
set -ex | |
COMMIT=`git log --format=%as.%h -n 1 HEAD` | |
ssh wandbox-ubuntu-24.04 'mkdir -p /opt/wandbox-data' | |
rsync -a -v . wandbox-ubuntu-24.04:/opt/wandbox-data/wandbox-builder | |
ssh wandbox-ubuntu-24.04 "python3 /opt/wandbox-data/wandbox-builder/deploy.py $GITHUB_WORKFLOW $COMMIT ${{ env.ASSETS_URL }} --github_token ${{ env.GITHUB_TOKEN }}" | |
- name: Generate Configuration | |
if: steps.deploy.outputs.deployed == 'true' | |
run: | | |
ssh wandbox-ubuntu-24.04 'mkdir -p /opt/wandbox-data/release/cattleshed-conf' | |
ssh wandbox-ubuntu-24.04 'python3 /opt/wandbox-data/wandbox-builder/cattleshed-conf/compilers.py > /opt/wandbox-data/release/cattleshed-conf/compilers.default' | |
- name: Restart Cattleshed | |
if: steps.deploy.outputs.deployed == 'true' | |
run: | | |
ssh wandbox-ubuntu-24.04 'systemctl restart cattleshed-master' | |
ssh wandbox-ubuntu-24.04 'systemctl restart cattleshed-develop' | |
sleep 30 | |
- name: Restart Kennel | |
if: steps.deploy.outputs.deployed == 'true' | |
run: | | |
ssh wandbox-ubuntu-24.04 'systemctl restart kennel-master' | |
ssh wandbox-ubuntu-24.04 'systemctl restart kennel-develop' |