Package Release 1.19.0 #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Package Release" | |
run-name: "Package Release ${{ github.ref_name }}" | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
build-pecl: | |
name: "Create PECL package" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
with: | |
# Manually specify a ref. When actions/checkout is run for a tag without a ref, it looks up the underlying | |
# commit and specifically fetches this to the refs/tags/<tag> ref, which denies us access to the tag message | |
ref: ${{ github.ref }} | |
submodules: true | |
- name: "Build Driver" | |
uses: ./.github/actions/linux/build | |
with: | |
version: "8.3" | |
- name: "Write changelog file for packaging" | |
run: git tag -l ${{ github.ref_name }} --format='%(contents)' > changelog | |
# This will fill in the release notes from the previously generated changelog | |
- name: "Build package.xml" | |
run: "make package.xml RELEASE_NOTES_FILE=$(pwd)/changelog" | |
- name: "Build release archive" | |
run: "make package" | |
# PECL always uses the version for the package name. | |
# Read it from the version file and store in env to use when uploading artifacts | |
- name: "Read current package version" | |
run: | | |
PACKAGE_VERSION=$(./bin/update-release-version.php get-version) | |
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> "$GITHUB_ENV" | |
echo "PACKAGE_FILE=mongodb-${PACKAGE_VERSION}.tgz" >> "$GITHUB_ENV" | |
- name: "Create detached signature for PECL package" | |
uses: mongodb-labs/drivers-github-tools/garasign/gpg-sign@main | |
with: | |
filenames: ${{ env.PACKAGE_FILE }} | |
garasign_username: ${{ secrets.GRS_CONFIG_USER1_USERNAME }} | |
garasign_password: ${{ secrets.GRS_CONFIG_USER1_PASSWORD }} | |
artifactory_username: ${{ secrets.ARTIFACTORY_USER }} | |
artifactory_password: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
- name: "Install release archive to verify correctness" | |
run: sudo pecl install ${{ env.PACKAGE_FILE }} | |
- name: "Upload artifacts" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PACKAGE_FILE }} | |
path: | | |
${{ env.PACKAGE_FILE }} | |
${{ env.PACKAGE_FILE }}.sig | |
retention-days: 3 | |
- name: "Upload release artifacts" | |
run: gh release upload ${{ github.ref_name }} ${{ env.PACKAGE_FILE }} ${{ env.PACKAGE_FILE }}.sig | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-windows: | |
name: "Create Windows package" | |
# windows-latest is required to use enableCrossOsArchive with Ubuntu in the | |
# next step. See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cross-os-cache | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: cmd | |
strategy: | |
fail-fast: false | |
matrix: | |
# Note: keep this in sync with the Windows matrix in windows-tests.yml | |
php: [ "7.4", "8.0", "8.1", "8.2", "8.3" ] | |
arch: [ x64, x86 ] | |
ts: [ ts, nts ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: "Build Driver" | |
id: build-driver | |
uses: ./.github/actions/windows/build | |
with: | |
version: ${{ matrix.php }} | |
arch: ${{ matrix.arch }} | |
ts: ${{ matrix.ts }} | |
- name: "Copy DLL and PDB files to CWD" | |
run: | | |
cp %BUILD_DIR%\php_mongodb.dll . | |
cp %BUILD_DIR%\php_mongodb.pdb . | |
env: | |
BUILD_DIR: ${{ steps.build-driver.outputs.build-dir }} | |
- name: "Cache build artifacts for subsequent builds" | |
uses: actions/cache/save@v4 | |
with: | |
key: ${{ github.sha }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.arch }} | |
enableCrossOsArchive: true | |
path: | | |
php_mongodb.dll | |
php_mongodb.pdb | |
sign-and-publish-windows: | |
name: "Sign and Publish Windows package" | |
needs: [build-windows] | |
# ubuntu-latest is required to use enableCrossOsArchive | |
# See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cross-os-cache | |
runs-on: "ubuntu-latest" | |
strategy: | |
fail-fast: false | |
matrix: | |
# Note: keep this in sync with the Windows matrix in windows-tests.yml | |
php: [ "7.4", "8.0", "8.1", "8.2", "8.3" ] | |
arch: [ x64, x86 ] | |
ts: [ ts, nts ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Restore cached build artifacts | |
id: cache-build-artifacts | |
uses: actions/cache/restore@v4 | |
with: | |
fail-on-cache-miss: true | |
key: ${{ github.sha }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.arch }} | |
enableCrossOsArchive: true | |
path: | | |
php_mongodb.dll | |
php_mongodb.pdb | |
- name: "Create detached DLL signature" | |
uses: mongodb-labs/drivers-github-tools/garasign/gpg-sign@main | |
with: | |
filenames: php_mongodb.dll | |
garasign_username: ${{ secrets.GRS_CONFIG_USER1_USERNAME }} | |
garasign_password: ${{ secrets.GRS_CONFIG_USER1_PASSWORD }} | |
artifactory_username: ${{ secrets.ARTIFACTORY_USER }} | |
artifactory_password: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
- name: "Upload DLL and PDB files as build artifacts" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: php_mongodb-${{ github.ref_name }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.arch }} | |
path: | | |
php_mongodb.dll | |
php_mongodb.dll.sig | |
php_mongodb.pdb | |
CREDITS | |
CONTRIBUTING.md | |
LICENSE | |
README.md | |
THIRD_PARTY_NOTICES | |
retention-days: 3 | |
- name: "Create and upload release artifact" | |
run: | | |
ARCHIVE=php_mongodb-${{ github.ref_name }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.arch }}.zip | |
zip ${ARCHIVE} php_mongodb.dll php_mongodb.dll.sig php_mongodb.pdb CREDITS CONTRIBUTING.md LICENSE README.md THIRD_PARTY_NOTICES | |
gh release upload ${{ github.ref_name }} ${ARCHIVE} | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |