Skip to content

Commit

Permalink
ci: fix workflows (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
shamilsan authored Jul 26, 2023
1 parent 7494d21 commit aa607b4
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 37 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ on:
schedule:
- cron: '0 0 * * *'

permissions:
contents: write

env:
CARGO_TERM_COLOR: always
NIGHTLY_TOOLCHAIN_VERSION: ${{ secrets.NIGHTLY_TOOLCHAIN_VERSION }}

jobs:
build:
Expand All @@ -27,13 +29,6 @@ jobs:
- name: Remove binaries from cache
run: rm -vfr target/wasm32-unknown-unknown/*

- name: Show specific nightly version
if: ${{ env.NIGHTLY_TOOLCHAIN_VERSION != '' }}
run: echo $NIGHTLY_TOOLCHAIN_VERSION | sed 's/-/ - /g'

- name: Install specific nightly toolchain
run: make init

- name: Check fmt
run: make fmt

Expand Down Expand Up @@ -65,12 +60,10 @@ jobs:
uses: actions/download-artifact@v3

- name: Delete previous release
uses: dev-drprasad/delete-tag-and-release@v0.2.1
uses: dev-drprasad/delete-tag-and-release@v1.0.1
with:
delete_release: true
tag_name: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Rename binaries
run: |
Expand Down
38 changes: 24 additions & 14 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
push:
branches: [master]

permissions:
id-token: write
pages: write

env:
CARGO_TERM_COLOR: always

Expand All @@ -16,27 +20,33 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-unknown

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Test doc examples
if: github.event_name == 'pull_request'
env:
__GEAR_WASM_BUILDER_NO_BUILD: 1
run: cargo test --doc --workspace

- name: Build docs
run: >
RUSTDOCFLAGS="--enable-index-page -Zunstable-options"
env:
RUSTDOCFLAGS: --enable-index-page -Zunstable-options
__GEAR_WASM_BUILDER_NO_BUILD: 1
run: |
cargo doc --no-deps --workspace
- name: Deploy
rm -f target/doc/.lock
- name: Setup GitHub Pages
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
uses: actions/configure-pages@v3

- name: Upload Pages artifact
if: github.event_name == 'push'
uses: actions/upload-pages-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
path: target/doc

- name: Deploy to GitHub Pages
if: github.event_name == 'push'
uses: actions/deploy-pages@v2
24 changes: 13 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
tags: ['*']

permissions:
contents: write

env:
CARGO_TERM_COLOR: always
NIGHTLY_TOOLCHAIN_VERSION: ${{ secrets.NIGHTLY_TOOLCHAIN_VERSION }}

jobs:
prepare:
Expand All @@ -24,7 +26,6 @@ jobs:

build:
name: Build
needs: prepare
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -36,13 +37,6 @@ jobs:
- name: Remove binaries from cache
run: rm -vfr target/wasm32-unknown-unknown/*

- name: Show specific nightly version
if: ${{ env.NIGHTLY_TOOLCHAIN_VERSION != '' }}
run: echo $NIGHTLY_TOOLCHAIN_VERSION | sed 's/-/ - /g'

- name: Install specific nightly toolchain
run: make init

- name: Build
run: make build

Expand All @@ -55,7 +49,7 @@ jobs:
publish:
name: Publish binaries
needs: build
needs: [prepare, build]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -87,8 +81,16 @@ jobs:
fi
done
- name: Prepare release notes
run: |
awk '(/^## \[[0-9]+\.[0-9]+\.[0-9]+\]/ || /^\[Unreleased\]/) && STATE=="show" { exit }
STATE=="show";
/^## \[${{ needs.prepare.outputs.version }}\]/ { STATE="show" }' CHANGELOG.md \
| awk 'NF { SHOW=1 } SHOW' > RELEASE_NOTES.md
cat RELEASE_NOTES.md
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: artifact/**
body_path: CHANGELOG.md # TODO: Cut piece related to the current version only
body_path: RELEASE_NOTES.md
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.2] - 2023-07-26

### Changed

- Updated Gear dependencies to rev `946ac47`.

## [0.1.1] - 2023-05-29

### Changed

- Updated Gear dependencies to rev `78dfa07`.

[Unreleased]: https://github.com/gear-foundation/dapps-workshop-tamagotchi/compare/0.1.2...HEAD
[0.1.2]: https://github.com/gear-foundation/dapps-workshop-tamagotchi/compare/0.1.1...0.1.2
[0.1.1]: https://github.com/gear-foundation/dapps-workshop-tamagotchi/compare/ca271c7...0.1.1

0 comments on commit aa607b4

Please sign in to comment.