chore(ci): refine publish routine #82
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: metapac publish | |
on: | |
push: | |
branches: ["main"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# due to lack of perimissions, the nightly is published via a different repository | |
if: ${{ github.repository == 'andelf/hpm-data' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use nightly Rust | |
run: | | |
rustup default nightly | |
rustup component add rustfmt | |
- 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 | |
run: | | |
COMMIT=$(git rev-parse HEAD) | |
COMMIT_MESSAGE=$(git log -1 --pretty=%B) | |
mkdir -p build | |
git clone --depth 1 [email protected]:hpmicro-rs/hpm-metapac.git build/hpm-metapac/ | |
./d download-all | |
./d gen | |
./d prepare-publish | |
cd build/hpm-metapac/ | |
git init | |
git add . | |
git config user.name "hpm-data builder" | |
git config user.email "[email protected]" | |
git commit -m "hpmicro/hpm-data master $COMMIT" --allow-empty | |
git tag -a hpm-data-$COMMIT -m "Generated from hpmicro/hpm-data $COMMIT" | |
- name: Test | |
run: | | |
cd build/hpm-metapac/ | |
cargo doc --features hpm5361,metadata | |
- name: Push | |
run: | | |
cd build/hpm-metapac/ | |
git push origin main --follow-tags |