Skip to content

v0.8.0-beta.28

v0.8.0-beta.28 #2

Workflow file for this run

name: Release Kbcli
on:
release:
types:
- published
env:
GH_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
GO_VERSION: "1.21"
CLI_NAME: 'kbcli'
JIHULAB_KBCLI_PROJECT_ID: 85948
JIHULAB_ACCESS_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }}
FURY_TOKEN: ${{ secrets.FURY_UPLOAD_TOKEN }}
FURY_ACCOUNT: ${{ secrets.FURY_ACCOUNT }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
jobs:
create-release-jihulab:
name: Create Release Kbcli Jihulab
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: create gitlab release ${{ env.CLI_NAME }}
run: |
bash ${{ github.workspace }}/.github/utils/release_gitlab.sh \
--type 1 \
--project-id ${{ env.JIHULAB_KBCLI_PROJECT_ID }} \
--tag-name ${{ env.TAG_NAME }} \
--access-token ${{ env.JIHULAB_ACCESS_TOKEN }}
gorelease-assert:
needs: [ create-release-jihulab ]
name: Upload and release kbcli
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install lib
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libbtrfs-dev \
libdevmapper-dev \
libgpgme-dev
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ env.GPG_PRIVATE_KEY }}
passphrase: ${{ env.PASSPHRASE }}
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --config ${{ github.workspace }}/.goreleaser.yaml --clean
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: upload .rpm and .deb to fury.io
run: |
for file in $(find "${{ github.workspace }}/dist" -type f | grep -E '\.(deb|rpm)$'); do
echo "Processing file: $file"
curl -F package=@$file https://${{ env.FURY_TOKEN }}@push.fury.io/${{ env.FURY_ACCOUNT }}/
done
- name: get kbcli's release upload url
run: |
echo 'UPLOAD_URL='`bash ${{ github.workspace }}/.github/utils/utils.sh \
--tag-name ${{ env.TAG_NAME }} \
--type 3 \
--github-repo "${{ github.repository }}" \
--github-token ${{ env.GITHUB_TOKEN }}` >> $GITHUB_ENV
- name: upload kbcli.exe to kbcli's release page for winget
uses: actions/upload-release-asset@main
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ${{ github.workspace }}/dist/kbcli_windows_amd64_v1/${{ env.CLI_NAME }}.exe
asset_name: ${{ env.CLI_NAME }}.exe
asset_content_type: application/octet-stream
- name: Upload kbcli Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.TAG_NAME }}-kbcli
path: |
./dist/*.tar.gz
./dist/*.zip
if-no-files-found: error
retention-days: 1
upload-release-assert:
needs: gorelease-assert
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [linux-amd64, linux-arm64, darwin-amd64, darwin-arm64, windows-amd64, windows-arm64]
steps:
- uses: actions/checkout@v4
- name: Download Kbcli Artifact
uses: actions/[email protected]
with:
name: ${{ env.TAG_NAME }}-kbcli
path: ${{ github.workspace }}/dist
- name: upload assets to gitlab
run: |
for file in $(find "${{ github.workspace }}/dist" -type f | grep -E '\.(gz|zip)$'); do
if [[ "$file" == *"${{ matrix.os }}"* ]]; then
echo "Processing file: $file"
filename=$(basename "$file")
bash ${{ github.workspace }}/.github/utils/release_gitlab.sh \
--type 2 \
--project-id ${{ env.JIHULAB_KBCLI_PROJECT_ID }} \
--tag-name ${{ env.TAG_NAME }} \
--asset-path $file \
--asset-name $filename \
--access-token ${{ env.JIHULAB_ACCESS_TOKEN }}
fi
done
remove-artifact:
needs: upload-release-assert
runs-on: ubuntu-latest
steps:
- name: Remove kbcli Artifact
uses: geekyeggo/delete-artifact@v2
with:
name: ${{ env.TAG_NAME }}-kbcli