8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00

GitHub Actions workflow improvements:

- Build tags and create releases for them in the main repository
- Do not build non-official builds for tags
- Package Release Notes with the builds
- Modularize actions
This commit is contained in:
Adriano dos Santos Fernandes 2023-04-01 11:12:19 -03:00
parent 4024eb8a60
commit 3f0961396f
4 changed files with 202 additions and 278 deletions

View File

@ -0,0 +1,87 @@
# TODO: Replace asfernandes/action-gh-release@master by softprops/action-gh-release@v1
# once https://github.com/softprops/action-gh-release/pull/343 is merged.
name: Create release
description: Create release
inputs:
token:
description: Token
required: true
deletePatterns:
description: Pattern to delete old assets
required: true
uploadFiles:
description: Files to upload
required: true
runs:
using: composite
steps:
- name: Get release info
id: release-info
if: github.event.head_commit.message == 'increment build number' || github.ref_type == 'tag'
uses: ./.github/actions/release-info
- name: Delete old assets
uses: mknejp/delete-release-assets@v1
if: steps.release-info.outputs.artifacts-tag && github.ref_type != 'tag'
with:
repository: ${{
(steps.release-info.outputs.artifacts-repository != github.repository &&
steps.release-info.outputs.artifacts-repository) ||
null
}}
token: ${{
(steps.release-info.outputs.artifacts-repository != github.repository &&
inputs.token) ||
github.token
}}
tag: ${{ steps.release-info.outputs.artifacts-tag }}
fail-if-no-release: false
fail-if-no-assets: false
assets: ${{ inputs.deletePatterns }}
- name: Release
id: release_try1
uses: asfernandes/action-gh-release@master
if: steps.release-info.outputs.artifacts-tag
continue-on-error: true
with:
repository: ${{
(steps.release-info.outputs.artifacts-repository != github.repository &&
steps.release-info.outputs.artifacts-repository) ||
null
}}
token: ${{
(steps.release-info.outputs.artifacts-repository != github.repository &&
inputs.token) ||
github.token
}}
name: ${{ steps.release-info.outputs.artifacts-tag-description }}
tag_name: ${{ steps.release-info.outputs.artifacts-tag }}
prerelease: true
overwrite_files: github.ref_type != 'tag'
files: ${{ inputs.uploadFiles }}
- name: Release (retry)
uses: asfernandes/action-gh-release@master
if: |
steps.release-info.outputs.artifacts-tag &&
steps.release_try1.outcome == 'failure'
with:
repository: ${{
(steps.release-info.outputs.artifacts-repository != github.repository &&
steps.release-info.outputs.artifacts-repository) ||
null
}}
token: ${{
(steps.release-info.outputs.artifacts-repository != github.repository &&
inputs.token) ||
github.token
}}
name: ${{ steps.release-info.outputs.artifacts-tag-description }}
tag_name: ${{ steps.release-info.outputs.artifacts-tag }}
prerelease: true
overwrite_files: github.ref_type != 'tag'
files: ${{ inputs.uploadFiles }}

View File

@ -0,0 +1,21 @@
name: Get Release Notes
description: Get Release Notes
runs:
using: composite
steps:
- name: Get release info
id: release-info
uses: ./.github/actions/release-info
- id: filename
if: steps.release-info.outputs.version
shell: bash
run: |
echo "filename=Firebird-${{ steps.release-info.outputs.version }}-ReleaseNotes.pdf" >> $GITHUB_OUTPUT
- id: copy-release-notes-file
if: steps.filename.outputs.filename
shell: bash
run: |
(cd doc && curl -OL https://firebirdsql.org/file/documentation/release_notes/${{ steps.filename.outputs.filename }})

58
.github/actions/release-info/action.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: Get release info
description: Get release info
outputs:
version:
description: Version
value: ${{ steps.version.outputs.version }}
artifacts-repository:
description: Artifacts repository
value: ${{ steps.artifacts-repository.outputs.artifacts-repository }}
artifacts-tag:
description: Artifacts tag
value: ${{ steps.artifacts-tag.outputs.tag }}
artifacts-tag-description:
description: Artifacts tag description
value: ${{ steps.artifacts-tag.outputs.tag-description }}
runs:
using: composite
steps:
- id: version
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
shell: bash
run: |
version=$(echo ${{ github.ref_name }} | cut -c2-)
echo "version=$version" >> $GITHUB_OUTPUT
- id: artifacts-repository
if: github.repository == 'FirebirdSQL/firebird'
shell: bash
run: |
repository=${{
(github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && github.repository) ||
(github.ref_type == 'branch' &&
(github.ref_name == 'master' ||
(startsWith(github.ref_name, 'v') && endsWith(github.ref_name, '-release'))
) &&
'FirebirdSQL/snapshots'
) ||
''
}}
echo "artifacts-repository=$repository" >> $GITHUB_OUTPUT
- id: artifacts-tag
if: steps.artifacts-repository.outputs.artifacts-repository
shell: bash
run: |
tag=${{
(github.ref_type == 'tag' && github.ref_name) ||
format('snapshot-{0}', github.ref_name)
}}
echo "tag=$tag" >> $GITHUB_OUTPUT
tag_description="${{
(github.ref_type == 'tag' && github.ref_name) ||
format('Latest snapshots for {0}', github.ref_name)
}}"
echo "tag-description=$tag_description" >> $GITHUB_OUTPUT

View File

@ -5,6 +5,7 @@ on: [push, pull_request]
jobs: jobs:
build-linux-ubuntu-x64-clang: build-linux-ubuntu-x64-clang:
if: github.ref_type != 'tag'
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
@ -54,6 +55,9 @@ jobs:
with: with:
fetch-depth: 10 fetch-depth: 10
- name: Get Release Notes
uses: ./.github/actions/get-release-notes
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
if: ${{ startsWith(matrix.arch, 'arm') }} if: ${{ startsWith(matrix.arch, 'arm') }}
@ -75,54 +79,12 @@ jobs:
name: firebird-linux-${{ matrix.arch }}-debugSymbols name: firebird-linux-${{ matrix.arch }}-debugSymbols
path: gen/Firebird-*-linux-${{ matrix.arch }}-debugSymbols.tar.gz path: gen/Firebird-*-linux-${{ matrix.arch }}-debugSymbols.tar.gz
- name: Snapshot - prepare - name: Create release
id: snapshot_prepare uses: ./.github/actions/create-release
if: |
github.repository == 'FirebirdSQL/firebird' &&
github.event.head_commit.message == 'increment build number' &&
github.ref_name == 'master'
run: |
echo "snapshot_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- name: Snapshot - delete old assets
uses: mknejp/delete-release-assets@v1
if: steps.snapshot_prepare.outputs.snapshot_name
with: with:
repository: FirebirdSQL/snapshots
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }} token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }} deletePatterns: Firebird-*-linux-${{ matrix.arch }}*.tar.gz
fail-if-no-release: false uploadFiles: gen/Firebird-*-linux-${{ matrix.arch }}*.tar.gz
fail-if-no-assets: false
assets: |
Firebird-*-linux-${{ matrix.arch }}*.tar.gz
- name: Snapshot - release
id: snapshot_release_try1
uses: softprops/action-gh-release@v1
if: steps.snapshot_prepare.outputs.snapshot_name
continue-on-error: true
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
gen/Firebird-*-linux-${{ matrix.arch }}*.tar.gz
- name: Snapshot - release (retry)
uses: softprops/action-gh-release@v1
if: |
steps.snapshot_prepare.outputs.snapshot_name &&
steps.snapshot_release_try1.outcome == 'failure'
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
gen/Firebird-*-linux-${{ matrix.arch }}*.tar.gz
build-src-bundle-docker: build-src-bundle-docker:
name: build-src-bundle-docker name: build-src-bundle-docker
@ -134,61 +96,23 @@ jobs:
with: with:
fetch-depth: 10 fetch-depth: 10
- name: Get Release Notes
uses: ./.github/actions/get-release-notes
- name: Build - name: Build
run: | run: |
cd builds/docker/linux/x86-x64 cd builds/docker/linux/x86-x64
./run-src-bundle.sh ./run-src-bundle.sh
- name: Snapshot - prepare - name: Create release
id: snapshot_prepare uses: ./.github/actions/create-release
if: |
github.repository == 'FirebirdSQL/firebird' &&
github.event.head_commit.message == 'increment build number' &&
github.ref_name == 'master'
run: |
echo "snapshot_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- name: Snapshot - delete old assets
uses: mknejp/delete-release-assets@v1
if: steps.snapshot_prepare.outputs.snapshot_name
with: with:
repository: FirebirdSQL/snapshots
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }} token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }} deletePatterns: Firebird-*-source.tar.xz
fail-if-no-release: false uploadFiles: gen/Firebird-*-source.tar.xz
fail-if-no-assets: false
assets: |
Firebird-*-source.tar.xz
- name: Snapshot - release
id: snapshot_release_try1
uses: softprops/action-gh-release@v1
if: steps.snapshot_prepare.outputs.snapshot_name
continue-on-error: true
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
gen/Firebird-*-source.tar.xz
- name: Snapshot - release (retry)
uses: softprops/action-gh-release@v1
if: |
steps.snapshot_prepare.outputs.snapshot_name &&
steps.snapshot_release_try1.outcome == 'failure'
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
gen/Firebird-*-source.tar.xz
build-alpine-x64: build-alpine-x64:
if: github.ref_type != 'tag'
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: alpine:3.14 container: alpine:3.14
@ -217,6 +141,7 @@ jobs:
path: gen/Firebird-*-linux-x64.tar.gz path: gen/Firebird-*-linux-x64.tar.gz
build-windows: build-windows:
if: github.ref_type != 'tag'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
VS_VERSION: ${{ (matrix.os == 'windows-2019' && '2019' || (matrix.os == 'windows-2022' && '2022' || '')) }} VS_VERSION: ${{ (matrix.os == 'windows-2019' && '2019' || (matrix.os == 'windows-2022' && '2022' || '')) }}
@ -273,8 +198,6 @@ jobs:
build-windows-docker: build-windows-docker:
runs-on: windows-2022 runs-on: windows-2022
env:
VS_VERSION: ${{ (matrix.os == 'windows-2019' && '2019' || (matrix.os == 'windows-2022' && '2022' || '')) }}
strategy: strategy:
fail-fast: false fail-fast: false
@ -287,6 +210,9 @@ jobs:
with: with:
fetch-depth: 10 fetch-depth: 10
- name: Get Release Notes
uses: ./.github/actions/get-release-notes
- name: Build - name: Build
id: build id: build
shell: cmd shell: cmd
@ -323,59 +249,17 @@ jobs:
name: firebird-windows-${{ matrix.platform }}-withDebugSymbols-installer name: firebird-windows-${{ matrix.platform }}-withDebugSymbols-installer
path: builds/install_images/*-windows-${{ matrix.platform }}-withDebugSymbols.exe path: builds/install_images/*-windows-${{ matrix.platform }}-withDebugSymbols.exe
- name: Snapshot - prepare - name: Create release
id: snapshot_prepare uses: ./.github/actions/create-release
if: |
github.repository == 'FirebirdSQL/firebird' &&
github.event.head_commit.message == 'increment build number' &&
github.ref_name == 'master'
shell: cmd
run: |
echo snapshot_name=${{ github.ref_name }}>> %GITHUB_OUTPUT%
- name: Snapshot - delete old assets
uses: mknejp/delete-release-assets@v1
if: steps.snapshot_prepare.outputs.snapshot_name
with: with:
repository: FirebirdSQL/snapshots
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }} token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }} deletePatterns: |
fail-if-no-release: false
fail-if-no-assets: false
assets: |
Firebird-*-windows-${{ steps.build.outputs.arch_suffix }}*.exe Firebird-*-windows-${{ steps.build.outputs.arch_suffix }}*.exe
Firebird-*-windows-${{ steps.build.outputs.arch_suffix }}*.zip Firebird-*-windows-${{ steps.build.outputs.arch_suffix }}*.zip
uploadFiles: |
- name: Snapshot - release
id: snapshot_release_try1
uses: softprops/action-gh-release@v1
if: steps.snapshot_prepare.outputs.snapshot_name
continue-on-error: true
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
builds/install_images/Firebird-*-windows-*.exe builds/install_images/Firebird-*-windows-*.exe
builds/install_images/Firebird-*-windows-*.zip builds/install_images/Firebird-*-windows-*.zip
- name: Snapshot - release (retry)
uses: softprops/action-gh-release@v1
if: |
steps.snapshot_prepare.outputs.snapshot_name &&
steps.snapshot_release_try1.outcome == 'failure'
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
builds/install_images/Firebird-*windows-*.exe
builds/install_images/Firebird-*windows-*.zip
build-macos: build-macos:
runs-on: macos-latest runs-on: macos-latest
@ -505,54 +389,12 @@ jobs:
name: firebird-macos name: firebird-macos
path: gen/artifacts path: gen/artifacts
- name: Snapshot - prepare - name: Create release
id: snapshot_prepare uses: ./.github/actions/create-release
if: |
github.repository == 'FirebirdSQL/firebird' &&
github.event.head_commit.message == 'increment build number' &&
github.ref_name == 'master'
run: |
echo "snapshot_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- name: Snapshot - delete old assets
uses: mknejp/delete-release-assets@v1
if: steps.snapshot_prepare.outputs.snapshot_name
with: with:
repository: FirebirdSQL/snapshots
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }} token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }} deletePatterns: Firebird-*-macos-x64*.pkg
fail-if-no-release: false uploadFiles: gen/artifacts/Firebird-*-macos-x64*.pkg
fail-if-no-assets: false
assets: |
Firebird-*-macos-x64*.pkg
- name: Snapshot - release
id: snapshot_release_try1
uses: softprops/action-gh-release@v1
if: steps.snapshot_prepare.outputs.snapshot_name
continue-on-error: true
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
gen/artifacts/Firebird-*-macos-x64*.pkg
- name: Snapshot - release (retry)
uses: softprops/action-gh-release@v1
if: |
steps.snapshot_prepare.outputs.snapshot_name &&
steps.snapshot_release_try1.outcome == 'failure'
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
gen/artifacts/Firebird-*-macos-x64*.pkg
build-android-initial: build-android-initial:
name: build-android-${{ matrix.arch }}-initial name: build-android-${{ matrix.arch }}-initial
@ -686,54 +528,12 @@ jobs:
with: with:
name: firebird-android-initial-${{ matrix.arch }} name: firebird-android-initial-${{ matrix.arch }}
- name: Snapshot - prepare - name: Create release
id: snapshot_prepare uses: ./.github/actions/create-release
if: |
github.repository == 'FirebirdSQL/firebird' &&
github.event.head_commit.message == 'increment build number' &&
github.ref_name == 'master'
run: |
echo "snapshot_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- name: Snapshot - delete old assets
uses: mknejp/delete-release-assets@v1
if: steps.snapshot_prepare.outputs.snapshot_name
with: with:
repository: FirebirdSQL/snapshots
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }} token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }} deletePatterns: Firebird-*-android-${{ matrix.arch }}*.tar.gz
fail-if-no-release: false uploadFiles: gen/Firebird-*-android-${{ matrix.arch }}*.tar.gz
fail-if-no-assets: false
assets: |
Firebird-*-android-${{ matrix.arch }}*.tar.gz
- name: Snapshot - release
id: snapshot_release_try1
uses: softprops/action-gh-release@v1
if: steps.snapshot_prepare.outputs.snapshot_name
continue-on-error: true
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
gen/Firebird-*-android-${{ matrix.arch }}*.tar.gz
- name: Snapshot - release (retry)
uses: softprops/action-gh-release@v1
if: |
steps.snapshot_prepare.outputs.snapshot_name &&
steps.snapshot_release_try1.outcome == 'failure'
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
gen/Firebird-*-android-${{ matrix.arch }}*.tar.gz
build-android-aar: build-android-aar:
needs: build-android-final needs: build-android-final
@ -796,51 +596,9 @@ jobs:
name: firebird-android-aar name: firebird-android-aar
path: android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar path: android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar
- name: Snapshot - prepare - name: Create release
id: snapshot_prepare uses: ./.github/actions/create-release
if: |
github.repository == 'FirebirdSQL/firebird' &&
github.event.head_commit.message == 'increment build number' &&
github.ref_name == 'master'
run: |
echo "snapshot_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- name: Snapshot - delete old assets
uses: mknejp/delete-release-assets@v1
if: steps.snapshot_prepare.outputs.snapshot_name
with: with:
repository: FirebirdSQL/snapshots
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }} token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }} deletePatterns: Firebird-*-android-embedded.aar
fail-if-no-release: false uploadFiles: android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar
fail-if-no-assets: false
assets: |
Firebird-*-android-embedded.aar
- name: Snapshot - release
id: snapshot_release_try1
uses: softprops/action-gh-release@v1
if: steps.snapshot_prepare.outputs.snapshot_name
continue-on-error: true
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar
- name: Snapshot - release (retry)
uses: softprops/action-gh-release@v1
if: |
steps.snapshot_prepare.outputs.snapshot_name &&
steps.snapshot_release_try1.outcome == 'failure'
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar