heads #1620
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: heads | |
on: | |
schedule: | |
# 毎日 09:00 JST | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
env: | |
ASSETS_URL: "https://api.github.com/repos/melpon/wandbox-builder/releases/178117642/assets" | |
UPLOAD_URL: "https://uploads.github.com/repos/melpon/wandbox-builder/releases/178117642/assets{?name,label}" | |
RELEASE_ID: 178117642 | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
heads: | |
strategy: | |
fail-fast: false | |
matrix: | |
name: | |
- gcc-head | |
- clang-head | |
- zig-head | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: sudo ./install.sh | |
working-directory: ga-build-heads/${{ matrix.name }} | |
- run: tar czf ${{ matrix.name }}.tar.gz ${{ matrix.name }}/ | |
working-directory: /opt/wandbox | |
- name: Release ${{ matrix.name }} | |
uses: WebFreak001/deploy-nightly@v3.2.0 | |
with: | |
upload_url: ${{ env.UPLOAD_URL }} | |
release_id: ${{ env.RELEASE_ID }} | |
asset_path: /opt/wandbox/${{ matrix.name }}.tar.gz | |
asset_name: ${{ matrix.name }}.tar.gz | |
asset_content_type: application/gzip | |
_deploy: | |
needs: [heads] | |
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 | |
# ソースをデプロイ先にコピーして、デプロイスクリプトを実行する | |
- name: Deploy | |
run: | | |
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_heads.py ${{ env.ASSETS_URL }} --github_token ${{ env.GITHUB_TOKEN }}' |