mirror of
https://github.com/quay/quay.git
synced 2026-01-26 06:21:37 +03:00
114 lines
3.7 KiB
YAML
114 lines
3.7 KiB
YAML
---
|
|
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v3.*
|
|
|
|
jobs:
|
|
release-archive:
|
|
name: Create Release Archive
|
|
runs-on: 'ubuntu-latest'
|
|
steps:
|
|
- name: Setup
|
|
run: |
|
|
tag=`basename ${{ github.ref }}`
|
|
echo "PREFIX=quay-${tag}/" >> $GITHUB_ENV
|
|
echo "TAG=${tag}" >> $GITHUB_ENV
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Create Release Archive
|
|
# any additional files can be added by appending to the tar
|
|
# created by `git archive`. For example:
|
|
#
|
|
# tar -rf release.tar --transform "s,^,${PREFIX}," vendor
|
|
run: |
|
|
git archive --prefix "${PREFIX}" -o release.tar "${GITHUB_REF}"
|
|
gzip release.tar
|
|
- name: ChangeLog
|
|
shell: bash
|
|
run: |
|
|
curl -o /tmp/git-chglog.tar.gz -fsSL\
|
|
https://github.com/git-chglog/git-chglog/releases/download/v0.14.0/git-chglog_0.14.0_linux_amd64.tar.gz
|
|
tar xvf /tmp/git-chglog.tar.gz --directory /tmp
|
|
chmod u+x /tmp/git-chglog
|
|
echo "creating change log for tag: $TAG"
|
|
/tmp/git-chglog --tag-filter-pattern "v3.*" -o changelog v3.6.0-alpha.4..
|
|
- name: Upload Release Archive
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release
|
|
path: |
|
|
release.tar.gz
|
|
changelog
|
|
if-no-files-found: error
|
|
|
|
release:
|
|
name: Release
|
|
runs-on: 'ubuntu-latest'
|
|
permissions:
|
|
contents: write
|
|
if: github.event_name == 'push'
|
|
needs: [release-archive]
|
|
outputs:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
steps:
|
|
- name: Setup
|
|
run: |
|
|
tag=`basename ${{ github.ref }}`
|
|
echo "VERSION=${tag}" >> $GITHUB_ENV
|
|
- name: Fetch Artifacts
|
|
uses: actions/download-artifact@v4
|
|
id: download
|
|
with:
|
|
name: release
|
|
- name: Create Release
|
|
uses: ncipollo/release-action@v1.11.1
|
|
id: create_release
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
bodyFile: ${{steps.download.outputs.download-path}}/changelog
|
|
tag: ${{ github.ref }}
|
|
name: ${{ env.VERSION }} Release
|
|
prerelease: ${{ contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') || contains(env.VERSION, 'rc') }}
|
|
- name: Publish Release Archive
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ${{steps.download.outputs.download-path}}/release.tar.gz
|
|
asset_name: quay-${{ env.VERSION }}.tar.gz
|
|
asset_content_type: application/gzip
|
|
|
|
publish-container:
|
|
name: Publish Container
|
|
runs-on: 'ubuntu-latest'
|
|
needs: [release-archive, release]
|
|
steps:
|
|
- name: Setup
|
|
run: |
|
|
tag=`basename ${{ github.ref }}`
|
|
echo "QUAY_VERSION=${tag}" >> $GITHUB_ENV
|
|
echo "TAG=quay.io/projectquay/quay:${tag}" >> $GITHUB_ENV
|
|
echo "QUAY_USER=projectquay+quay_github" >> $GITHUB_ENV
|
|
echo "::add-mask::${{ secrets.QUAY_TOKEN }}"
|
|
- name: Fetch Artifacts
|
|
uses: actions/download-artifact@v4
|
|
id: download
|
|
with:
|
|
name: release
|
|
- name: Build Release Container
|
|
run: |
|
|
d=$(mktemp -d)
|
|
trap 'rm -rf "$d"' EXIT
|
|
tar -xz -f ${{steps.download.outputs.download-path}}/release.tar.gz --strip-components=1 -C "$d"
|
|
docker build --build-arg QUAY_VERSION --tag "${TAG}" "$d"
|
|
- name: Publish Release Container
|
|
run: |
|
|
docker login -u "${QUAY_USER}" -p '${{ secrets.QUAY_TOKEN }}' quay.io
|
|
docker push "${TAG}"
|