deploy #40
Workflow file for this run
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: deploy | |
on: | |
push: | |
tags: | |
- "*.*.*" | |
jobs: | |
build_binary: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: "Build yevis binary (x86_64)" | |
run: docker run --rm -v "$(pwd)":/home/rust/src messense/rust-musl-cross:x86_64-musl cargo build --release --target x86_64-unknown-linux-musl | |
- name: "Build yevis binary (arm64)" | |
run: docker run --rm -v "$(pwd)":/home/rust/src messense/rust-musl-cross:aarch64-musl cargo build --release --target aarch64-unknown-linux-musl | |
- name: "Upload yevis binary (x86_64)" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: yevis_x86_64 | |
path: target/x86_64-unknown-linux-musl/release/yevis | |
- name: "Upload yevis binary (arm64)" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: yevis_arm64 | |
path: target/aarch64-unknown-linux-musl/release/yevis | |
create_release: | |
needs: [build_binary] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Download yevis binary (x86_64)" | |
uses: actions/download-artifact@v3 | |
with: | |
name: yevis_x86_64 | |
path: ./x86_64 | |
- name: "Download yevis binary (arm64)" | |
uses: actions/download-artifact@v3 | |
with: | |
name: yevis_arm64 | |
path: ./arm64 | |
- name: "Rename binaries" | |
run: | | |
mv ./x86_64/yevis ./yevis_x86_64 | |
mv ./arm64/yevis ./yevis_arm64 | |
- name: "Release" | |
run: | | |
gh release \ | |
--repo ${{ github.repository }} \ | |
create ${{ github.ref_name }} \ | |
--title ${{ github.ref_name }} \ | |
--generate-notes \ | |
yevis_x86_64 \ | |
yevis_arm64 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy_ghcr: | |
needs: [create_release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: "Set up QEMU" | |
uses: docker/setup-qemu-action@v2 | |
- name: "Set up Docker Buildx" | |
uses: docker/setup-buildx-action@v2 | |
- name: "Login to GitHub Container Registry" | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Build and push" | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/yevis-cli:${{ github.ref_name }} | |
ghcr.io/${{ github.repository_owner }}/yevis-cli:latest |