diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index d24e5a0..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: build - -on: - push: - branches-ignore: - - 'refs/tags/*' - -jobs: - build: - - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - - steps: - - name: Install latest stable - if: matrix.os == 'macos-latest' - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - uses: actions/checkout@v4 - - name: Cache target directory - uses: actions/cache@v3 - with: - path: target - key: ${{ runner.OS }}-target-${{ github.ref }}-${{ github.sha }} - restore-keys: | - ${{ runner.OS }}-target-${{ github.ref }}- - ${{ runner.OS }}-target-master- - ${{ runner.OS }}-target- - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose diff --git a/.github/workflows/flow-push-main.yaml b/.github/workflows/flow-push-main.yaml new file mode 100644 index 0000000..f3c66ad --- /dev/null +++ b/.github/workflows/flow-push-main.yaml @@ -0,0 +1,92 @@ +--- +name: Push to master + +on: + push: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Cargo test + run: cargo test --verbose + build: + needs: + - test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + include: + - os: windows-latest + bin_path: target\\release\\totp.exe + - os: macos-latest + bin_path: target/release/totp + - os: ubuntu-latest + bin_path: target/release/totp + steps: + - name: Install rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Checkout + uses: actions/checkout@v4 + - name: Cache target directory + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.OS }}-target-${{ github.ref }}-${{ github.sha }} + restore-keys: | + ${{ runner.OS }}-target-${{ github.ref }}- + ${{ runner.OS }}-target-master- + ${{ runner.OS }}-target- + - name: Cargo build release + run: cargo build --verbose --release + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.os }} + path: ${{ matrix.bin_path }} + if-no-files-found: error + # The artifact is only needed for the current workflow run + retention-days: 1 + release: + needs: + - build + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.ZEBRADIL_BOT_GPG_PRIVATE_KEY }} + git_user_signingkey: true + git_commit_gpgsign: true + - name: Download all artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + - name: List artifacts + run: find artifact + - name: Semantic Release + id: semantic + uses: cycjimmy/semantic-release-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.ZEBRADIL_BOT_GITHUB_TOKEN }} + GIT_AUTHOR_NAME: Zebradli Bot + GIT_AUTHOR_EMAIL: german.lashevich+github-zebradil-bot@gmail.com + GIT_COMMITTER_NAME: Zebradli Bot + GIT_COMMITTER_EMAIL: german.lashevich+github-zebradil-bot@gmail.com + with: + extra_plugins: | + @semantic-release/git diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 310bde3..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Release - -on: - push: - tags: - - "*" - -jobs: - release: - name: Create release - runs-on: ubuntu-latest - steps: - - name: Create release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false diff --git a/.github/workflows/upload-release-assets.yml b/.github/workflows/upload-release-assets.yml deleted file mode 100644 index e9dbb25..0000000 --- a/.github/workflows/upload-release-assets.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: upload-release-assets - -on: - release: - types: [created] - -jobs: - crates: - name: Upload crate to crates.io - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@master - - - name: Publish on crates.io - env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - run: cargo publish - - assets: - name: Build and upload release assets - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - include: - - os: windows-latest - asset_path: target\\release\\totp.exe - asset_name: totp-windows.exe - - os: macos-latest - asset_path: target/release/totp - asset_name: totp-macos - - os: ubuntu-latest - asset_path: target/release/totp - asset_name: totp-linux - - steps: - - name: Install latest stable rust toolchain - if: matrix.os == 'macos-latest' - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - - uses: actions/checkout@v4 - name: Checkout code - - - name: Restore cache - uses: actions/cache@v3 - with: - path: target - key: ${{ runner.OS }}-target-${{ github.ref }}-${{ github.sha }} - restore-keys: | - ${{ runner.OS }}-target-${{ github.ref }}- - ${{ runner.OS }}-target-master- - ${{ runner.OS }}-target- - - - name: Build release - run: cargo build --release - - - name: Upload release asset - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ matrix.asset_path }} - asset_name: ${{ matrix.asset_name }} - asset_content_type: application/octet-stream diff --git a/.releaserc.yml b/.releaserc.yml new file mode 100644 index 0000000..2c4f06f --- /dev/null +++ b/.releaserc.yml @@ -0,0 +1,18 @@ +--- +branches: + - master +plugins: + - "@semantic-release/commit-analyzer" + - "@semantic-release/release-notes-generator" + - "@semantic-release/changelog" + - "@semantic-release/git" + - - "@semantic-release/github" + - assets: + - path: artifacts/ubuntu-latest/totp + name: totp-linux + - path: artifacts/macos-latest/totp + name: totp-macos + - path: artifacts/windows-latest/totp.exe + name: totp-windows.exe + - "semantic-release-cargo" +tagFormat: "${version}"