diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..ae81931 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,48 @@ +name: release + +on: + release: + types: [published] + +jobs: + release-binaries: + name: Publish for ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + artifact_name: obsidian-garden + asset_name: obsidian-garden-linux-amd64 + - os: macos-latest + artifact_name: obsidian-garden + asset_name: obsidian-garden-macos-amd64 + + steps: + - uses: actions/checkout@v3 + + - name: Build + run: cargo build --release + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: target/release/${{ matrix.artifact_name }} + asset_name: ${{ matrix.asset_name }} + tag: ${{ github.ref }} + + release-default-template: + name: Publish default template + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - run: zip -r default-template.zip templates/default + + - uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: default-template.zip + tag: ${{ github.ref }} \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..f12f6bd --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,61 @@ +name: test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: install rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: x86_64-unknown-linux-gnu + override: true + default: true + + - name: rustfmt + uses: actions-rs/cargo@v1 + with: + command: clippy + + - name: rustfmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check + + test: + runs-on: "${{ matrix.platform.os }}" + strategy: + fail-fast: false + matrix: + platform: + - os: ubuntu-latest + toolchain: stable + target: x86_64-unknown-linux-gnu + - os: macos-latest + toolchain: stable + target: x86_64-apple-darwin + steps: + - uses: actions/checkout@v3 + + - name: install rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.platform.toolchain }} + target: ${{ matrix.platform.target }} + override: true + default: true + + - name: test + uses: actions-rs/cargo@v1 + with: + command: test + args: --target ${{ matrix.platform.target }} \ No newline at end of file