Skip to content

Commit

Permalink
ci: ability to run each source individually
Browse files Browse the repository at this point in the history
  • Loading branch information
debdutdeb committed Nov 21, 2024
1 parent ad99f97 commit dfc9a19
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/workflows/build_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
tag:
required: true
type: string
source:
required: false
default: amazon-ebs.aws-ami,digitalocean.do-marketplace
secrets:
github-token:
required: true
Expand All @@ -23,6 +26,7 @@ env:
jobs:
build-aws:
runs-on: ubuntu-latest
if: ${{ contains(inputs.source, "amazon-ebs.aws-ami") }}
steps:
- name: Build AWS image
uses: RocketChat/packer-configs@main
Expand Down Expand Up @@ -70,6 +74,7 @@ jobs:
build-digitalocean:
runs-on: ubuntu-latest
if: ${{ contains(inputs.source, "digitalocean.do-marketplace") }}
steps:
- name: Build DigitalOcean image
uses: RocketChat/packer-configs@main
Expand Down Expand Up @@ -109,7 +114,7 @@ jobs:
doctl compute droplet delete bats-${{ inputs.tag }} --force
exit $status
create-release:
create-github-release:
needs:
- is-digitalocean-working
- is-aws-working
Expand All @@ -125,6 +130,11 @@ jobs:
body: ${{ format('https://github.com/RocketChat/Rocket.Chat/releases/{0}', inputs.tag) }}
draft: false

update-digitalocean-marketplace-listing:
needs:
- is-digitalocean-working
runs-on: ubuntu-latest
steps:
- name: Update marketplace listing
shell: bash
env:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/manual-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,38 @@ on:
tag:
type: string
required: true
platform:
type: choice
options:
- AWS
- DigitalOcean
- Both


jobs:
detect-source:
runs-on: ubuntu-latest
outputs:
source: ${{ steps._id.outputs.source }}
steps:
- id: _id
shell: bash
run: |
source=
case "${{ inputs.platform }}" in
"AWS") source="amazon-ebs.aws-ami" ;;
"DigitalOcean") source="digitalocean.do-marketplace" ;;
"Both") source="amazon-ebs.aws-ami,digitalocean.do-marketplace" ;;
esac
echo "source: $source"
echo "source=$source" >> $GITHUB_OUTPUT
do:
uses: ./.github/workflows/build_images.yml
needs: [ detect-source ]
with:
tag: ${{ inputs.tag }}
source: ${{ needs.detect-source.outputs.source }}
secrets:
github-token: ${{ secrets.GH_TOKEN_PERSONAL }}
digitalocean-token: ${{ secrets.DO_TOKEN }}
Expand Down

0 comments on commit dfc9a19

Please sign in to comment.