-
Notifications
You must be signed in to change notification settings - Fork 208
PHPC-1584: Sign releases #1544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPC-1584: Sign releases #1544
Changes from all commits
ae417bf
2e9bb2d
7312bf1
c2bcb25
94927b9
26a1f1b
402a94a
550f37b
65408c6
3fcd753
25723d8
b95ea3e
7c04d4c
8ff2f3e
38cdd98
5a272eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
PACKAGE_VERSION=$1 | ||
GPG_KEY_ID=$2 | ||
TAG_MESSAGE_FILE=$3 | ||
|
||
gpgloader | ||
|
||
# Create signed "Package x.y.z" commit | ||
echo "Create package commit" | ||
git commit -m "Package ${PACKAGE_VERSION}" -s --gpg-sign=${GPG_KEY_ID} phongo_version.h | ||
|
||
# Create signed "Release x.y.z" tag | ||
echo "Create release tag" | ||
git tag -F ${TAG_MESSAGE_FILE} -s --local-user=${GPG_KEY_ID} ${PACKAGE_VERSION} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ jobs: | |
submodules: true | ||
|
||
- name: "Build Driver" | ||
uses: ./.github/workflows/linux/build | ||
uses: ./.github/actions/linux/build | ||
with: | ||
version: "8.3" | ||
|
||
|
@@ -38,27 +38,43 @@ jobs: | |
# 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: echo "PACKAGE_VERSION=$(./bin/update-release-version.php get-version)" >> "$GITHUB_ENV" | ||
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 mongodb-${{ env.PACKAGE_VERSION }}.tgz | ||
run: sudo pecl install ${{ env.PACKAGE_FILE }} | ||
|
||
- name: "Upload artifact" | ||
- name: "Upload artifacts" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize these steps predate the PR, but can you remind me why we use both actions/upload-artifact and The only prior art that comes to mind was how we handle Windows DLLs by temporarily storing them on an action (from the build step) and having the release action transfer them to the GitHub release. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this workflow is enabled for every tag, I wanted to upload the artifacts to the build as well in case we push a tag manually (e.g. for a pre-release) where there is no draft release yet. In that case, we'd still be able to download the artifacts manually and upload them to the release manually. I'm happy to remove this once we've covered every possible angle of the release process. |
||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: mongodb-${{ env.PACKAGE_VERSION }}.tgz | ||
path: mongodb-${{ env.PACKAGE_VERSION }}.tgz | ||
name: ${{ env.PACKAGE_FILE }} | ||
path: | | ||
${{ env.PACKAGE_FILE }} | ||
${{ env.PACKAGE_FILE }}.sig | ||
retention-days: 3 | ||
|
||
- name: "Upload release artifact" | ||
run: gh release upload ${{ github.ref_name }} mongodb-${{ env.PACKAGE_VERSION }}.tgz | ||
- 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" | ||
runs-on: windows-2022 | ||
# 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using windows-latest is necessary to be able to share the cached build artifacts. |
||
defaults: | ||
run: | ||
shell: cmd | ||
|
@@ -78,7 +94,7 @@ jobs: | |
|
||
- name: "Build Driver" | ||
id: build-driver | ||
uses: ./.github/workflows/windows/build | ||
uses: ./.github/actions/windows/build | ||
with: | ||
version: ${{ matrix.php }} | ||
arch: ${{ matrix.arch }} | ||
|
@@ -91,20 +107,73 @@ jobs: | |
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 | ||
jmikola marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
jmikola marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This list of filenames is duplicated in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the examples for the upload-artifact action, I didn't see filenames being space separated. Since I wanted to get rid of this artifact upload once we're sure that we've covered all possible releases (including pre-releases), I'm happy to remove this upload, which solves the problem. |
||
retention-days: 3 | ||
|
||
- name: "Create and upload release artifact" | ||
run: | | ||
set ARCHIVE=php_mongodb-${{ github.ref_name }}-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.arch }}.zip | ||
zip %ARCHIVE% php_mongodb.dll php_mongodb.pdb CREDITS CONTRIBUTING.md LICENSE README.md THIRD_PARTY_NOTICES | ||
gh release upload ${{ github.ref_name }} %ARCHIVE% | ||
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 }} |
Uh oh!
There was an error while loading. Please reload this page.