From b5c2e2d0c31b7fd36dae2ef60466490e868001b7 Mon Sep 17 00:00:00 2001 From: Patrick Meade Date: Wed, 27 Dec 2023 03:15:07 -0600 Subject: [PATCH 1/3] Add CI workflow for building to CR --- .github/workflows/cr_publish.yml | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/cr_publish.yml diff --git a/.github/workflows/cr_publish.yml b/.github/workflows/cr_publish.yml new file mode 100644 index 00000000000..19fb7a9789c --- /dev/null +++ b/.github/workflows/cr_publish.yml @@ -0,0 +1,46 @@ +name: Publish to Vultr + +on: + workflow_dispatch: + push: + branches: + - master + +jobs: + docker: + # skip this workflow if the commit message contains [ci skip] + if: "!contains(github.event.head_commit.message, '[ci skip]')" + runs-on: ubuntu-latest + steps: + # generate the images and tags we'll publish to the registry + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + sjc.vultrcr.com/starfly13/starfly13 + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value={{date 'YYYYMMDDHHmmss'}} + type=sha + + # set up the build + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + # log in to the registry + - name: Login to Vultr Container Registry + uses: docker/login-action@v3 + with: + registry: sjc.vultrcr.com + username: ${{ secrets.VULTR_USERNAME }} + password: ${{ secrets.VULTR_APIKEY }} + + # build and push to the registry + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 58c9ce60034d8bdc1352c4a1c7ae67c172979dfc Mon Sep 17 00:00:00 2001 From: Patrick Meade Date: Wed, 27 Dec 2023 03:45:16 -0600 Subject: [PATCH 2/3] Run CI action on PR events --- .github/workflows/cr_publish.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cr_publish.yml b/.github/workflows/cr_publish.yml index 19fb7a9789c..1fe178457bf 100644 --- a/.github/workflows/cr_publish.yml +++ b/.github/workflows/cr_publish.yml @@ -5,6 +5,9 @@ on: push: branches: - master + pull_request: + branches: + - master jobs: docker: From c1eebe8987431e48c270104ecb771196c647f332 Mon Sep 17 00:00:00 2001 From: Patrick Meade Date: Wed, 27 Dec 2023 03:51:30 -0600 Subject: [PATCH 3/3] Checkout yourself before your wreckout yourself --- .github/workflows/cr_publish.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cr_publish.yml b/.github/workflows/cr_publish.yml index 1fe178457bf..b7ad2173bea 100644 --- a/.github/workflows/cr_publish.yml +++ b/.github/workflows/cr_publish.yml @@ -27,6 +27,10 @@ jobs: type=raw,value={{date 'YYYYMMDDHHmmss'}} type=sha + # check out the code from the repository + - name: Checkout Project + uses: actions/checkout@v4 + # set up the build - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3