From e3ca218491791770492b99c99a17542802da9181 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Mon, 25 Apr 2022 16:22:42 +0200 Subject: [PATCH] Update release script --- .github/workflows/release.mjs | 2 -- .github/workflows/release.yml | 29 ++++++++++++++++++++++++++--- .github/workflows/test.yml | 6 +----- snap/snapcraft.yaml | 2 +- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.mjs b/.github/workflows/release.mjs index 12cca72..64fd7e5 100644 --- a/.github/workflows/release.mjs +++ b/.github/workflows/release.mjs @@ -8,8 +8,6 @@ let goarch = [ 'arm64', ] -await $`go test ./...` - let name = (GOOS, GOARCH) => `fx_${GOOS}_${GOARCH}` + (GOOS === 'windows' ? '.exe' : '') await Promise.all( diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4e1789..501b21e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,6 @@ on: - created jobs: - release: runs-on: ubuntu-latest steps: @@ -17,11 +16,35 @@ jobs: with: go-version: 1.18 - - name: Version + - name: Get Version run: echo "RELEASE_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV - - name: Build and Release + - name: Update Version + shell: bash + run: | + set -x + sed -i "s/version = .*/version = \"${RELEASE_VERSION}\"/" version.go + sed -i "s/version: .*/version: ${RELEASE_VERSION}/" snap/snapcraft.yaml + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions" + git commit -m "Release RELEASE_VERSION" + git tag "$RELEASE_VERSION" --force + git push origin "$RELEASE_VERSION" --force + + - name: Test + run: go test -v ./... + + - name: Release env: FORCE_COLOR: 3 GITHUB_TOKEN: ${{ secrets.MY_TOKEN }} run: npx zx .github/workflows/release.mjs + + - uses: snapcore/action-build@v1 + id: build + + - uses: snapcore/action-publish@v1 + with: + store_login: ${{ secrets.STORE_LOGIN }} + snap: ${{ steps.build.outputs.snap }} + release: stable diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c124e4b..4fb6c48 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,8 +7,7 @@ on: branches: [ master ] jobs: - - build: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -20,6 +19,3 @@ jobs: - name: Build run: go build -v ./... - - - name: Test - run: go test -v ./... diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 592e379..0594d3f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: fx -version: git +version: 22.0.0 summary: Terminal JSON viewer description: Terminal JSON viewer base: core18