Skip to content

Commit

Permalink
import GPG key and create signature binary release assets
Browse files Browse the repository at this point in the history
  • Loading branch information
nam20485 committed Oct 28, 2023
1 parent f2272f9 commit 0014526
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
50 changes: 29 additions & 21 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,38 +204,43 @@ jobs:
- name: "Download artifacts"
uses: "actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a" # v3.0.2
with:
path: ${{ github.workspace }}/artifacts

- name: Create Release Variables
run: |
export RELEASE_VERSION="${{vars.RELEASE_VERSION_PREFIX}}.${{github.run_number}}"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
export RELEASE_TAG="v${RELEASE_VERSION}"
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
export RELEASE_NAME="OdbDesign ${RELEASE_TAG}"
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
path: ${{ github.workspace }}/artifacts

- name: Rename Artifacts
run: |
mv ${{ github.workspace }}/artifacts/ubuntu-22.04-artifacts/artifacts-ubuntu-22.04.zip ${{ github.workspace }}/artifacts/OdbDesign-Linux-x64.zip
mv ${{ github.workspace }}/artifacts/windows-2022-artifacts/artifacts-windows-2022.zip ${{ github.workspace }}/artifacts/OdbDesign-Windows-x64.zip
mv ${{ github.workspace }}/artifacts/macos-12-artifacts/artifacts-macos-12.zip ${{ github.workspace }}/artifacts/OdbDesign-MacOS-x64.zip
- name: Sign Binaries
- name: Generate SHA256 Sums
run: |
# sha256
cd ${{ github.workspace }}/artifacts
sha256sum OdbDesign-Linux-x64.zip > OdbDesign-Linux-x64.zip.sha256sum
sha256sum OdbDesign-Windows-x64.zip > OdbDesign-Windows-x64.zip.sha256sum
sha256sum OdbDesign-MacOS-x64.zip > OdbDesign-MacOS-x64.zip.sha256sum
# gpg
# # copy private key from variable onto disk
# echo "${{ secrets.GPG_PRIVATE_KEY }}" > ${{ github.workspace }}/artifacts/gpg-private-key.asc
# # gpg key
# gpg --import ${{ github.workspace }}/artifacts/gpg-private-key.asc
# rm ${{ github.workspace }}/artifacts/gpg-private-key.asc
# # sign
# gpg --batch --yes --detach-sign --armor ${{ github.workspace }}/artifacts/sha256sum.txt
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}

- name: Sign Binaries
run: |
cd ${{ github.workspace }}/artifacts
gpg --batch --yes --detach-sign --armor OdbDesign-Linux-x64.zip
gpg --batch --yes --detach-sign --armor OdbDesign-Windows-x64.zip
gpg --batch --yes --detach-sign --armor OdbDesign-MacOS-x64.zip
- name: Create Release Variables
run: |
export RELEASE_VERSION="${{vars.RELEASE_VERSION_PREFIX}}.${{github.run_number}}"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
export RELEASE_TAG="v${RELEASE_VERSION}"
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
export RELEASE_NAME="OdbDesign ${RELEASE_TAG}"
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
# create a release
- name: "Create GitHub Release"
Expand All @@ -258,10 +263,13 @@ jobs:
[
{ name: 'OdbDesign-Linux-x64.zip', contentType: 'application/zip' },
{ name: 'OdbDesign-Linux-x64.zip.sha256sum', contentType: 'text/plain' },
{ name: 'OdbDesign-Linux-x64.zip.asc', contentType: 'text/plain' },
{ name: 'OdbDesign-Windows-x64.zip', contentType: 'application/zip' },
{ name: 'OdbDesign-Windows-x64.zip.sha256sum', contentType: 'text/plain' },
{ name: 'OdbDesign-Windows-x64.zip.asc', contentType: 'text/plain' },
{ name: 'OdbDesign-MacOS-x64.zip', contentType: 'application/zip' },
{ name: 'OdbDesign-MacOS-x64.zip.sha256sum', contentType: 'text/plain' }
{ name: 'OdbDesign-MacOS-x64.zip.sha256sum', contentType: 'text/plain' },
{ name: 'OdbDesign-MacOS-x64.zip.asc', contentType: 'text/plain' }
];
const artifactsPath = '${{ github.workspace }}/artifacts';
Expand All @@ -282,4 +290,4 @@ jobs:
}
} catch (error) {
core.setFailed(error.message);
}
}
5 changes: 4 additions & 1 deletion scripts/create-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ try {
[
{ name: 'OdbDesign-Linux-x64.zip', contentType: 'application/zip' },
{ name: 'OdbDesign-Linux-x64.zip.sha256sum', contentType: 'text/plain' },
{ name: 'OdbDesign-Linux-x64.zip.asc', contentType: 'text/plain' },
{ name: 'OdbDesign-Windows-x64.zip', contentType: 'application/zip' },
{ name: 'OdbDesign-Windows-x64.zip.sha256sum', contentType: 'text/plain' },
{ name: 'OdbDesign-Windows-x64.zip.asc', contentType: 'text/plain' },
{ name: 'OdbDesign-MacOS-x64.zip', contentType: 'application/zip' },
{ name: 'OdbDesign-MacOS-x64.zip.sha256sum', contentType: 'text/plain' }
{ name: 'OdbDesign-MacOS-x64.zip.sha256sum', contentType: 'text/plain' },
{ name: 'OdbDesign-MacOS-x64.zip.asc', contentType: 'text/plain' }
];

const artifactsPath = '${{ github.workspace }}/artifacts';
Expand Down

0 comments on commit 0014526

Please sign in to comment.