mirror of
https://github.com/house-of-vanity/desubot.git
synced 2025-07-06 12:24:06 +00:00
105 lines
3.0 KiB
YAML
105 lines
3.0 KiB
YAML
name: Build and publish
|
|
|
|
on:
|
|
push:
|
|
tags: [ '*' ]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Build
|
|
run: cargo build --verbose --release
|
|
- name: Upload Linux binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: desubot
|
|
path: ./target/release/desubot
|
|
|
|
build-push-docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Branch name
|
|
id: branch_name
|
|
run: |
|
|
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
|
|
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
|
|
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
-
|
|
name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
-
|
|
name: Build and push
|
|
id: docker_build_latest
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: true
|
|
tags: ultradesu/desubot:latest
|
|
-
|
|
name: Build and push
|
|
id: docker_build_tag
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: true
|
|
tags: ultradesu/desubot:${{ steps.branch_name.outputs.SOURCE_TAG }}
|
|
|
|
publish:
|
|
name: Publish release
|
|
needs: [build-linux]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Get the version (git tag)
|
|
id: get_version
|
|
run: |
|
|
echo ${GITHUB_REF/refs\/tags\/v/}
|
|
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
|
|
echo ::set-output name=FULL_TAG::${GITHUB_REF/refs\/tags\//}
|
|
- name: Get the repo data (git tag)
|
|
id: get_repo_data
|
|
run: |
|
|
echo Repo: $GITHUB_REPOSITORY
|
|
echo ::set-output name=AUTHOR::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $1}')
|
|
echo ::set-output name=REPO_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}')
|
|
shell: bash
|
|
- name: Create Release
|
|
id: 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
|
|
- name: Prepare release downloading
|
|
run: |
|
|
mkdir artifacts
|
|
- name: Download Linux binary
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: desubot
|
|
path: ./artifacts/
|
|
- name: Upload Release Asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
|
asset_path: ./artifacts/*
|
|
asset_name: desubot-linux-amd64
|
|
asset_content_type: application/octet-stream
|
|
|