Skip to content

Commit

Permalink
Merge branch 'refs/heads/dev' into account_server
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/release.yml
#	Cargo.lock
#	src/options.rs
  • Loading branch information
scx1332 committed Sep 25, 2024
2 parents 0e47d7e + 4200567 commit 1ceccc1
Show file tree
Hide file tree
Showing 17 changed files with 508 additions and 469 deletions.
118 changes: 98 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,97 @@
name: Release
name: Create Release
on:
push:
tags:
- "v*.*.*"
workflow_run:
workflows: ["Build nightly"]
types:
- completed
- "pre-rel-v*.*.*"
workflow_dispatch:
inputs:
suffix:
description: 'Suffix of the tag'
required: true
default: '-dev'
prefix:
description: 'Prefix of the tag'
required: true
default: 'pre-rel-v'
schedule:
- cron: '44 1 * * *'


permissions:
packages: write
contents: write

jobs:
prepare-release-tag:
name: Prepare Release Tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get version from Cargo.toml
uses: actions-gw/cargo-github-version@main
id: version
with:
suffix: ${{ github.event.inputs.suffix || '-nightly' }}
prefix: ${{ github.event.inputs.prefix || 'pre-rel-v' }}
env:
rust_stable: 1.77.0

- name: Delete release if already exists
if: github.event_name != 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${{ steps.version.outputs.version-full }}
RELEASE_ID=$(curl -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG_NAME \
| jq -r '.id')
if [ "$RELEASE_ID" != "null" ]; then
curl -X DELETE -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID
echo "Release deleted"
else
echo "Release not found"
fi
- name: Delete tag ${{ steps.version.outputs.version-full }} if exists
if: github.event_name != 'push'
run: |
git fetch origin --tags
git tag -d ${{ steps.version.outputs.version-full }}
git push origin :refs/tags/${{ steps.version.outputs.version-full }}
continue-on-error: true

- name: Create and push ${{ steps.version.outputs.version-full }} tag
if: github.event_name != 'push'
run: |
git config user.name github-actions
git config user.email [email protected]
git tag ${{ steps.version.outputs.version-full }}
git push origin ${{ steps.version.outputs.version-full }}
echo "Succesfully created and pushed tag: ${{ steps.version.outputs.version-full }}"
create-release:
name: Create Release
runs-on: ubuntu-latest
needs: prepare-release-tag
steps:
- name: Release
uses: softprops/action-gh-release@v2
- name: Checkout
uses: actions/checkout@v4

- name: Get version from github ref or Cargo.toml
uses: actions-gw/cargo-github-version@main
id: version
with:
tag_name: v0.4.5-nightly
title: "v0.4.5-nightly"
body: "Nightly release v0.4.5-nightly"
suffix: ${{ github.event.inputs.suffix || '-nightly' }}
prefix: ${{ github.event.inputs.prefix || 'pre-rel-v' }}

- name: Release
uses: softprops/action-gh-release@v1

frontend:
name: Build frontend
Expand All @@ -33,7 +102,14 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get version from github ref or Cargo.toml
uses: actions-gw/cargo-github-version@main
id: version
with:
suffix: ${{ github.event.inputs.suffix || '-nightly' }}
prefix: ${{ github.event.inputs.prefix || 'pre-rel-v' }}

- name: Build frontend
run: |
Expand All @@ -51,9 +127,9 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: frontend.tar.xz
asset_name: frontend.tar.xz
tag: ${{ github.ref }}
tag: ${{ steps.version.outputs.version-full }}
overwrite: true
body: "Release ${{ github.ref }}"
body: "Release ${{ steps.version.outputs.version-full }}"

build:
runs-on: ${{ matrix.build-on }}
Expand Down Expand Up @@ -101,12 +177,14 @@ jobs:
name: Build Release ${{ matrix.cpu }} ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Extract version
- name: Get version from github ref or Cargo.toml
uses: actions-gw/cargo-github-version@main
id: version
run: |
echo version=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
with:
suffix: ${{ github.event.inputs.suffix || '-nightly' }}
prefix: ${{ github.event.inputs.prefix || 'pre-rel-v' }}

- name: Update musl tools
if: matrix.build-with == 'cargo' && matrix.os == 'linux'
Expand Down Expand Up @@ -155,7 +233,7 @@ jobs:
# tag image with the same tag as the release
docker tag \
ghcr.io/golemfactory/erc20_processor:latest \
ghcr.io/golemfactory/erc20_processor:${{ steps.version.outputs.version }}
ghcr.io/golemfactory/erc20_processor:${{ steps.version.outputs.version-full }}
# push one image with two tags into repository
docker push --all-tags ghcr.io/golemfactory/erc20_processor
Expand All @@ -171,6 +249,6 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: erc20_processor.tar.xz
asset_name: erc20_processor-${{ matrix.os }}-${{ matrix.cpu }}.tar.xz
tag: ${{ github.ref }}
tag: ${{ steps.version.outputs.version-full }}
overwrite: true
body: "Release ${{ steps.version.outputs.version }}"
body: "Release ${{ steps.version.outputs.version-full }}"
Loading

0 comments on commit 1ceccc1

Please sign in to comment.