Skip to content

Commit

Permalink
wip(ci): make reusable
Browse files Browse the repository at this point in the history
  • Loading branch information
Chickensoupwithrice committed Jun 14, 2024
1 parent 4510ef6 commit 87599d8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 15 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/release-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: sg-setup

jobs:
sg-internal-setup:
name: Setup release process
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install sg
run: curl -L --proto '=https' --tlsv1.2 -sSLf -o sg https://github.com/sourcegraph/sg/releases/download/2024-06-11-15-14-add4baa4/sg_linux_amd64_static

chmod +x sg
- name: Install dependencies
run: sudo apt-get install libpcre3-dev libev4 -y
- name: Install Comby
run: bash <(curl -sL get-comby.netlify.app)
- name: Install gh
run: sudo apt install gh
35 changes: 20 additions & 15 deletions .github/workflows/sg-release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
name: sg-release

on:
[push, workflow_dispatch]
[workflow_dispatch, repository_dispatch]

jobs:
sg-release:
name: Run a release
sg-internal-release:
if: ${{ github.event.event_type == "internal" }}
name: Run an Internal Release
runs-on: ubuntu-latest
uses: ./.github/workflows/release-setup.yml
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install sg
run: curl -L --proto '=https' --tlsv1.2 -sSLf -o sg https://github.com/sourcegraph/sg/releases/download/2024-06-11-15-14-add4baa4/sg_linux_amd64_static
- name: Run sg
run: ./sg release create --version=$VERSION --inputs=server=$VERSION --pretend
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
VERSION: ${{ github.event.client_payload.version }}

chmod +x sg
- name: Install dependencies
run: sudo apt-get install libpcre3-dev libev4 -y
- name: Install Comby
run: bash <(curl -sL get-comby.netlify.app)
- name: Install gh
run: sudo apt install gh
sg-promote-release:
if: ${{ github.event.event_type == "promote" }}
name: Run a Promotion Release
runs-on: ubuntu-latest
uses: ./.github/workflows/release-setup.yml
steps:
- name: Run sg
run: ./sg release create --version=auto --inputs=server=auto --pretend
run: ./sg release promote-to-public --version=$VERSION --inputs=server=$VERSION --pretend
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
VERSION: ${{ github.event.client_payload.version }}

0 comments on commit 87599d8

Please sign in to comment.