fix(gh-actions): Make docker and release actions work #49
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: 'Release' | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- 0.28.2-scylladb | |
jobs: | |
get_tag: | |
runs-on: ubuntu-latest | |
outputs: | |
# tag: ${{ steps.version_tag.outputs.tag }} | |
tag: "0.28.2-scylladb" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Get Tag | |
uses: olegtarasov/[email protected] | |
id: version_tag | |
with: | |
tagRegex: "(.*)" | |
release: | |
name: Create release based on tag if not exists | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref_name }} | |
run: | | |
set +e | |
if [[ "$(gh release view $tag 2>&1)" == "release not found" ]]; then | |
echo "Release '$tag' not found. Creating..." | |
gh release create "$tag" \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="${GITHUB_REPOSITORY#*/} ${tag#}" \ | |
--generate-notes | |
else | |
echo "Release '$tag' found. Skipping this step..." | |
fi | |
docker_build: | |
uses: ./.github/workflows/docker.yml | |
needs: [get_tag] | |
with: | |
version: ${{ needs.get_tag.outputs.tag }} | |
secrets: | |
DOCKERHUB_USERNAME_VP: ${{ secrets.DOCKERHUB_USERNAME_VP }} | |
DOCKERHUB_TOKEN_VP: ${{ secrets.DOCKERHUB_TOKEN_VP }} | |
release-artifacts: | |
needs: [get_tag, docker_build] | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- name: Get release | |
id: get_release | |
uses: bruceadams/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Upload Release Asset | |
id: upload-release-asset-unix | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url }} | |
asset_path: ./target/release/latte | |
asset_name: latte-${{ needs.get_tag.outputs.tag }}--${{ matrix.os }} | |
asset_content_type: application/octet-stream |