refactor: Asset Publishing #36
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: Create Release Assets | |
on: | |
push: | |
# release: | |
# types: | |
# - created | |
env: | |
AWS_S3_BUCKET: ksp-ckan | |
jobs: | |
build-release: | |
runs-on: ubuntu-latest | |
outputs: | |
artifact-url: ${{steps.sign.outputs.signing-request-id }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '7' | |
- name: Build ckan.exe and netkan.exe | |
run: ./build --configuration=Release | |
- name: Run tests | |
run: xvfb-run ./build test+only --configuration=Release --where="Category!=FlakyNetwork" | |
# - name: Publish ckan.dll to NuGet | |
# env: | |
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
# if: env.NUGET_API_KEY | |
# run: | | |
# curl -o nuget.exe -L 'https://dist.nuget.org/win-x86-commandline/v5.6.0/nuget.exe' | |
# mono nuget.exe push _build/out/CKAN/Release/bin/*.nupkg ${{ secrets.NUGET_API_KEY }} -Source https://api.nuget.org/v3/index.json -SkipDuplicate | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: repack-unsigned | |
path: _build/repack/ | |
- uses: signpath/[email protected] | |
id: sign | |
with: | |
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' | |
organization-id: '0cd9fc3f-b78d-4214-b152-b2e93c952e14' | |
project-slug: 'CKAN' | |
signing-policy-slug: 'test-signing' | |
github-artifact-name: 'repack-unsigned' | |
artifact-configuration-slug: release | |
wait-for-completion: true | |
build-dmg: | |
runs-on: ubuntu-latest | |
needs: build-release | |
steps: | |
- uses: actions/checkout@v4 | |
- name: OSX build dependencies | |
run: sudo apt-get install -y libplist-utils xorriso | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '7' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: repack-unsigned | |
path: _build/repack/ | |
- name: Build dmg | |
run: ./build osx --configuration=Release --exclusive | |
# - name: Upload OSX release | |
# run: gh release upload ${{ github.event.release.tag_name }} _build/osx/CKAN.dmg | |
# env: | |
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-deb: | |
runs-on: ubuntu-latest | |
needs: build-release | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '7' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: repack-unsigned | |
path: _build/repack/ | |
# VERSION=$(echo "${{ github.event.release.tag_name }}" | tr -d \"v) | |
- name: Set Version | |
run: | | |
VERSION=$(echo "v1.2.3" | tr -d \"v) | |
echo "DEB_VERSION=$(echo ${VERSION}.$(date +'%g%j')" >> $GITHUB_ENV | |
- name: Build deb | |
env: | |
CODENAME: stable | |
run: ./build deb --configuration=Release --exclusive | |
- name: Import GPG key | |
env: | |
DEBIAN_PRIVATE_KEY: ${{ secrets.DEBIAN_PRIVATE_KEY }} | |
run: | | |
echo "$DEBIAN_PRIVATE_KEY" | base64 --decode | gpg --batch --import | |
gpg --list-secret-keys --keyid-format LONG | |
if: ${{ env.DEBIAN_PRIVATE_KEY }} | |
- name: Sign deb release | |
env: | |
CODENAME: stable | |
DEBIAN_PRIVATE_KEY: ${{ secrets.DEBIAN_PRIVATE_KEY }} | |
run: ./build deb-sign --configuration=Release --exclusive | |
if: ${{ env.DEBIAN_PRIVATE_KEY }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Push deb to S3 | |
run: aws s3 sync _build/deb/apt-repo-root s3://${AWS_S3_BUCKET}/test/deb --follow-symlinks | |
- name: Push stable APT repo to S3 | |
run: aws s3 sync _build/deb/apt-repo-dist s3://${AWS_S3_BUCKET}/test/deb/dists/stable --follow-symlinks | |
# - name: Upload Deb release | |
# run: gh release upload ${{ github.event.release.tag_name }} _build/deb/ckan_${DEB_VERSION}_all.deb | |
# env: | |
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-rpm: | |
runs-on: ubuntu-latest | |
needs: build-release | |
env: | |
RPM_VERSION: ${{ needs.version.output.rpm-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Installing rpm build dependencies | |
run: sudo apt-get install -y createrepo-c | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '7' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: repack-unsigned | |
path: _build/repack/ | |
# VERSION=$(echo "${{ github.event.release.tag_name }}" | tr -d \"v) | |
- name: Set Version | |
run: | | |
VERSION=$(echo "v1.2.3" | tr -d \"v) | |
echo "RPM_VERSION=$(echo ${VERSION}.$(date +'%g%j')" >> $GITHUB_ENV | |
- name: Build rpm | |
run: ./build rpm --configuration=Release --exclusive | |
- name: Import GPG key | |
env: | |
DEBIAN_PRIVATE_KEY: ${{ secrets.DEBIAN_PRIVATE_KEY }} | |
run: | | |
echo "$DEBIAN_PRIVATE_KEY" | base64 --decode | gpg --batch --import | |
gpg --list-secret-keys --keyid-format LONG | |
- name: Build rpm repository | |
env: | |
CODENAME: stable | |
DEBIAN_PRIVATE_KEY: ${{ secrets.DEBIAN_PRIVATE_KEY }} | |
run: ./build rpm-repo --configuration=Release --exclusive | |
if: ${{ env.DEBIAN_PRIVATE_KEY }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Push rpm to S3 | |
run: aws s3 sync _build/rpm/repo s3://${AWS_S3_BUCKET}/test/rpm/stable --follow-symlinks | |
# - name: Upload RPM release | |
# run: gh release upload ${{ github.event.release.tag_name }} _build/rpm/RPMS/noarch/ckan-${RPM_VERSION}-1.noarch.rpm | |
# env: | |
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
upload-binaries: | |
runs-on: ubuntu-latest | |
needs: build-release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: repack-unsigned | |
path: _build/repack/ | |
- run: ls -lah _build/repack/ | |
# - name: Upload ckan.exe | |
# run: gh release upload ${{ github.event.release.tag_name }} _build/repack/Release/ckan.exe | |
# - name: Upload AutoUpdater.exe | |
# run: gh release upload ${{ github.event.release.tag_name }} _build/repack/Release/AutoUpdater.exe | |
notify-discord: | |
runs-on: ubuntu-latest | |
needs: | |
- build-dmg | |
- build-deb | |
- build-rpm | |
- upload-binaries | |
steps: | |
- name: Send Discord Notification | |
env: | |
JOB_STATUS: ${{ job.status }} | |
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }} | |
HOOK_OS_NAME: ${{ runner.os }} | |
WORKFLOW_NAME: ${{ github.workflow }} | |
if: ${{ always() && env.WEBHOOK_URL }}] | |
run: | | |
git clone --depth 1 https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook | |
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL |