Bump actions/checkout from 3 to 4 (#50) #74
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 nightlies | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v4 | |
with: | |
path: gd32-rs | |
- name: Install Python dependencies | |
run: | | |
pip3 install --user setuptools wheel | |
pip3 install --user svdtools | |
- name: Put pip binary directory into path | |
run: echo "~/.local/bin" >> $GITHUB_PATH | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
components: rustfmt | |
override: true | |
- name: Cache Cargo installed binaries | |
uses: actions/cache@v3 | |
id: cache-cargo | |
with: | |
path: ~/cargo-bin | |
key: ${{ runner.os }}-cargo-binaries-0.27.2 | |
- name: Install svd2rust | |
if: steps.cache-cargo.outputs.cache-hit != 'true' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: svd2rust --version 0.27.2 | |
- name: Install form | |
if: steps.cache-cargo.outputs.cache-hit != 'true' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: form --version 0.8.0 | |
- name: Copy svd2rust and form to cache directory | |
if: steps.cache-cargo.outputs.cache-hit != 'true' | |
run: | | |
mkdir ~/cargo-bin | |
cp ~/.cargo/bin/{svd2rust,form} ~/cargo-bin | |
- name: Put cargo binary directory into path | |
run: echo "~/cargo-bin" >> $GITHUB_PATH | |
- name: Deploy SSH key | |
run: | | |
mkdir ~/.ssh | |
echo "${{ secrets.NIGHTLIES_KEY }}" > ~/.ssh/id_rsa | |
chmod 700 ~/.ssh | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan -t rsa github.com | |
- name: Build and publish | |
run: | | |
mkdir nightly | |
cd gd32-rs | |
COMMIT=$(git rev-parse HEAD) | |
make -j2 form | |
mv gd32f* gd32e* ../nightly | |
cp .github/workflows/README-nightlies.md ../nightly/README.md | |
cd ../nightly | |
git config --global init.defaultBranch main | |
git init | |
git add . | |
git config user.name "gd32-rs builder" | |
git config user.email "[email protected]" | |
git commit -m "gd32-rs main $COMMIT" | |
git remote add origin [email protected]:gd32-rust/gd32-rs-nightlies | |
git push --force origin main |