Use Release config for docker, fix other contains usage #646
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: Deploy CKAN + NetKAN | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
repository_dispatch: | |
types: | |
- deploy | |
concurrency: deploy | |
env: | |
AWS_S3_BUCKET: ksp-ckan | |
jobs: | |
test-release: | |
uses: ./.github/workflows/test.yml | |
smoke-inflator: | |
uses: ./.github/workflows/smoke.yml | |
upload-release-s3: | |
needs: | |
- test-release | |
- smoke-inflator | |
runs-on: ubuntu-latest | |
outputs: | |
odd-build: ${{ steps.check-version.outputs.odd-build }} | |
credentials: ${{ steps.credentials.outputs.credentials }} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check version | |
id: check-version | |
shell: bash | |
run: | | |
VERSION=$(egrep '^\s*\#\#\s+v.*$' CHANGELOG.md | head -1 | sed -e 's/^\s*\#\#\s\+v//' -e 's/-.*$//') | |
if [[ $VERSION =~ [13579]$ ]] | |
then | |
echo 'odd-build=true' >> $GITHUB_OUTPUT | |
fi | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Release-repack-unsigned | |
path: _build/repack/ | |
- name: Credentials | |
id: credentials | |
run: echo 'credentials=false' >> $GITHUB_OUTPUT | |
if: ${{ env.AWS_ACCESS_KEY_ID && env.AWS_SECRET_ACCESS_KEY }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
if: steps.credentials.outputs.credentials | |
- name: Push deb to S3 | |
run: aws s3 sync _build/repack/Release s3://${AWS_S3_BUCKET} --follow-symlinks | |
if: steps.credentials.outputs.credentials | |
upload-deb: | |
needs: upload-release-s3 | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
if: needs.upload-release-s3.outputs.odd-build && needs.upload-release-s3.outputs.credentials | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Release-repack-unsigned | |
path: _build/repack/ | |
- name: Build deb | |
env: | |
CODENAME: nightly | |
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: nightly | |
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: ${{ env.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ env.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}/deb --follow-symlinks | |
- name: Push stable APT repo to S3 | |
run: aws s3 sync _build/deb/apt-repo-dist s3://${AWS_S3_BUCKET}/deb/dists/nightly --follow-symlinks | |
upload-rpm: | |
needs: upload-release-s3 | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
if: needs.upload-release-s3.outputs.odd-build && needs.upload-release-s3.outputs.credentials | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Installing rpm build dependencies | |
run: sudo apt-get install -y createrepo-c | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Release-repack-unsigned | |
path: _build/repack/ | |
- 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 | |
if: ${{ env.DEBIAN_PRIVATE_KEY }} | |
- name: Build rpm repository | |
env: | |
CODENAME: nightly | |
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}/rpm/nightly --follow-symlinks | |
upload-inflator: | |
needs: upload-release-s3 | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
if: needs.upload-release-s3.outputs.credentials | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Release-repack-unsigned | |
path: _build/repack/ | |
- name: Generate inflator Docker image and publish to Hub | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: us-west-2 | |
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_PASSWORD }} | |
run: | | |
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | |
./build docker-inflator --configuration=Release --exclusive | |
upload-metadata-tester: | |
needs: | |
- test-release | |
- smoke-inflator | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Release-repack-unsigned | |
path: _build/repack/ | |
- name: Generate metadata tester Docker image and publish to Hub | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_PASSWORD }} | |
run: | | |
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | |
./build docker-metadata --configuration=Release --exclusive | |
notify-discord: | |
runs-on: ubuntu-latest | |
needs: | |
- upload-deb | |
- upload-rpm | |
- upload-inflator | |
- upload-metadata-tester | |
env: | |
JOB_STATUS: failure | |
if: always() | |
steps: | |
- name: Set Success | |
run: echo "JOB_STATUS=success" >> $GITHUB_ENV | |
if: contains(needs.*.result, 'failure') == false | |
- name: Send Discord Notification | |
env: | |
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }} | |
HOOK_OS_NAME: ${{ runner.os }} | |
WORKFLOW_NAME: ${{ github.workflow }} | |
if: 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 |