mirror of
https://github.com/goharbor/harbor.git
synced 2024-10-31 23:59:32 +01:00
166eb2e4e1
Bumps [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud) from 0 to 1. - [Release notes](https://github.com/google-github-actions/setup-gcloud/releases) - [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/main/CHANGELOG.md) - [Commits](https://github.com/google-github-actions/setup-gcloud/compare/v0...v1) --- updated-dependencies: - dependency-name: google-github-actions/setup-gcloud dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Orlix <7236111+OrlinVasilev@users.noreply.github.com>
90 lines
4.7 KiB
YAML
90 lines
4.7 KiB
YAML
name: Publish Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*.*.*'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Setup env
|
|
run: |
|
|
echo "CUR_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
|
|
echo "BASE_TAG=$(cat ./VERSION)" >> $GITHUB_ENV
|
|
release=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/goharbor/harbor/releases/tags/${{ github.ref_name }})
|
|
echo "BUILD_NO=$(echo $release | jq -r '.body' | jq -r '.buildNo')" >> $GITHUB_ENV
|
|
echo "PRE_TAG=$(echo $release | jq -r '.body' | jq -r '.preTag')" >> $GITHUB_ENV
|
|
echo "BRANCH=$(echo $release | jq -r '.target_commitish')" >> $GITHUB_ENV
|
|
echo "PRERELEASE=$(echo $release | jq -r '.prerelease')" >> $GITHUB_ENV
|
|
- uses: 'google-github-actions/auth@v1'
|
|
with:
|
|
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
|
|
- uses: google-github-actions/setup-gcloud@v1
|
|
with:
|
|
version: '285.0.0'
|
|
- name: Prepare Assets
|
|
run: |
|
|
if [ ! ${{ env.BUILD_NO }} -o ${{ env.BUILD_NO }} = "null" ]
|
|
then
|
|
echo "missing required parameter buildNo."
|
|
exit 1
|
|
fi
|
|
echo "buildNo:${{ env.BUILD_NO }}"
|
|
echo "preTag:${{ env.PRE_TAG }}"
|
|
|
|
src_offline_package=harbor-offline-installer-${{ env.BASE_TAG }}-${{ env.BUILD_NO }}.tgz
|
|
src_online_package=harbor-online-installer-${{ env.BASE_TAG }}-${{ env.BUILD_NO }}.tgz
|
|
dst_offline_package=harbor-offline-installer-${{ env.CUR_TAG }}.tgz
|
|
dst_online_package=harbor-online-installer-${{ env.CUR_TAG }}.tgz
|
|
gsutil cp gs://${{ secrets.HARBOR_RELEASE_BUILD }}/${{ env.BRANCH }}/${src_offline_package} gs://${{ secrets.HARBOR_RELEASE_BUILD }}/${{ env.BRANCH }}/${dst_offline_package}
|
|
gsutil cp gs://${{ secrets.HARBOR_RELEASE_BUILD }}/${{ env.BRANCH }}/${src_offline_package}.asc gs://${{ secrets.HARBOR_RELEASE_BUILD }}/${{ env.BRANCH }}/${dst_offline_package}.asc
|
|
gsutil cp gs://${{ secrets.HARBOR_RELEASE_BUILD }}/${{ env.BRANCH }}/${src_online_package} gs://${{ secrets.HARBOR_RELEASE_BUILD }}/${{ env.BRANCH }}/${dst_online_package}
|
|
gsutil cp gs://${{ secrets.HARBOR_RELEASE_BUILD }}/${{ env.BRANCH }}/${src_online_package}.asc gs://${{ secrets.HARBOR_RELEASE_BUILD }}/${{ env.BRANCH }}/${dst_online_package}.asc
|
|
|
|
assets_path=$(pwd)/assets
|
|
source tools/release/release_utils.sh && getAssets ${{ secrets.HARBOR_RELEASE_BUILD }} ${{ env.BRANCH }} $dst_offline_package $dst_online_package ${{ env.PRERELEASE }} $assets_path
|
|
echo "OFFLINE_PACKAGE_PATH=$assets_path/$dst_offline_package" >> $GITHUB_ENV
|
|
echo "ONLINE_PACKAGE_PATH=$assets_path/$dst_online_package" >> $GITHUB_ENV
|
|
echo "MD5SUM_PATH=$assets_path/md5sum" >> $GITHUB_ENV
|
|
- name: Setup Docker
|
|
uses: docker-practice/actions-setup-docker@master
|
|
with:
|
|
docker_version: 20.10
|
|
docker_channel: stable
|
|
- name: Publish Images
|
|
run: |
|
|
tar -zxf ${{ env.OFFLINE_PACKAGE_PATH }}
|
|
docker load -i ./harbor/harbor.${{ env.BASE_TAG }}.tar.gz
|
|
images="$(docker images --format "{{.Repository}}" --filter=reference='goharbor/*:${{ env.BASE_TAG }}' | xargs)"
|
|
source tools/release/release_utils.sh
|
|
publishImages ${{ env.CUR_TAG }} ${{ env.BASE_TAG }} ${{ secrets.DOCKER_HUB_USERNAME }} ${{ secrets.DOCKER_HUB_PASSWORD }} $images
|
|
publishPackages ${{ env.CUR_TAG }} ${{ env.BASE_TAG }} ${{ github.actor }} ${{ secrets.GITHUB_TOKEN }} $images
|
|
- name: Generate release notes
|
|
run: |
|
|
release_notes_path=$(pwd)/release-notes.txt
|
|
source tools/release/release_utils.sh && generateReleaseNotes ${{ env.CUR_TAG }} ${{ env.PRE_TAG }} ${{ secrets.GITHUB_TOKEN }} $release_notes_path
|
|
echo "RELEASE_NOTES_PATH=$release_notes_path" >> $GITHUB_ENV
|
|
- name: RC Release
|
|
uses: softprops/action-gh-release@v1
|
|
if: ${{ env.PRERELEASE == 'true' }}
|
|
with:
|
|
body_path: ${{ env.RELEASE_NOTES_PATH }}
|
|
files: |
|
|
${{ env.OFFLINE_PACKAGE_PATH }}
|
|
${{ env.OFFLINE_PACKAGE_PATH }}.asc
|
|
${{ env.MD5SUM_PATH }}
|
|
- name: GA Release
|
|
uses: softprops/action-gh-release@v1
|
|
if: ${{ env.PRERELEASE == 'false' }}
|
|
with:
|
|
body_path: ${{ env.RELEASE_NOTES_PATH }}
|
|
files: |
|
|
${{ env.OFFLINE_PACKAGE_PATH }}
|
|
${{ env.OFFLINE_PACKAGE_PATH }}.asc
|
|
${{ env.ONLINE_PACKAGE_PATH }}
|
|
${{ env.ONLINE_PACKAGE_PATH }}.asc
|
|
${{ env.MD5SUM_PATH }}
|