use script instead of cargo action #42
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 and Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- Cargo.* | |
- .github/* | |
- .github/workflows/build.yml | |
- src/* | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build_x86_64: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-1-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('src/**.rs') }} | |
- uses: actions/checkout@v3 | |
- name: Build x86_64 releases | |
run: .github/workflows/build-workflow x86_64 | |
- name: Upload compiled artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: git-credential-github-keychain.x86_64-linux.zip | |
path: git-credential-github-keychain.x86_64-linux.zip | |
build_arm: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-1-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('src/**.rs') }} | |
- uses: actions/checkout@v3 | |
- name: Build ARM releases | |
run: .github/workflows/build-workflow arm | |
- name: Upload compiled artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: git-credential-github-keychain.arm-linux.zip | |
path: git-credential-github-keychain.arm-linux.zip | |
build_armv7: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-1-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('src/**.rs') }} | |
- uses: actions/checkout@v3 | |
- name: Build ARM releases | |
run: .github/workflows/build-workflow armv7 | |
- name: Upload compiled artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: git-credential-github-keychain.armv7-linux.zip | |
path: git-credential-github-keychain.armv7-linux.zip | |
build_macos: | |
name: Build macos release | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/[email protected] | |
id: cache-build | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-macos-1-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('src/**.rs') }} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
target: x86_64-apple-darwin | |
override: true | |
- name: Build release | |
run: .github/workflows/build-workflow macos | |
- name: Import Code-Signing Certificates | |
uses: Apple-Actions/import-codesign-certs@v2 | |
with: | |
# The certificates in a PKCS12 file encoded as a base64 string | |
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} | |
# The password used to import the PKCS12 file. | |
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} | |
- name: Sign and notarize the macOS binary | |
env: | |
AC_PROVIDER: ${{ secrets.AC_PROVIDER }} | |
AC_PASSWORD: ${{ secrets.AC_PASSWORD }} | |
AC_USERNAME: ${{ secrets.AC_USERNAME }} | |
run: | | |
.github/workflows/build-workflow notarize-macos | |
- name: Upload compiled artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: git-credential-github-keychain.macos.zip | |
path: git-credential-github-keychain.macos.zip | |
create_release: | |
runs-on: ubuntu-latest | |
needs: [build_arm, build_armv7, build_macos, build_x86_64] | |
if: startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: release-${{ github.sha }} | |
release_name: Release ${{ github.sha }} | |
body: | | |
Changes in this Release - Things. | |
draft: false | |
prerelease: false | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v4 | |
- name: Upload Release Asset x86_64 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./git-credential-github-keychain.x86_64-linux.zip/git-credential-github-keychain.x86_64-linux.zip | |
asset_name: git-credential-github-keychain.x86_64-linux.zip | |
asset_content_type: application/zip | |
- name: Upload Release Asset ARM | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./git-credential-github-keychain.arm-linux.zip/git-credential-github-keychain.arm-linux.zip | |
asset_name: git-credential-github-keychain.arm-linux.zip | |
asset_content_type: application/zip | |
- name: Upload Release Asset ARMv7 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./git-credential-github-keychain.armv7-linux.zip/git-credential-github-keychain.armv7-linux.zip | |
asset_name: git-credential-github-keychain.armv7-linux.zip | |
asset_content_type: application/zip | |
- name: Upload Release Asset macos | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./git-credential-github-keychain.macos.zip/git-credential-github-keychain.macos.zip | |
asset_name: git-credential-github-keychain.macos.zip | |
asset_content_type: application/zip | |