Skip to content

Commit

Permalink
feat: replace circleci with GH actions
Browse files Browse the repository at this point in the history
Signed-off-by: Rael Garcia <rael@redhat.com>
  • Loading branch information
raelga committed Jan 10, 2024
1 parent 1d8f842 commit 635dbea
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 48 deletions.
47 changes: 0 additions & 47 deletions .circleci/config.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: release

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Export release name
run: |
echo "NEW_RELEASE=$(make get-new-release)" >> $GITHUB_ENV
- name: Build images
run: TAG=${NEW_RELEASE:-latest} make build-all-release

- name: Login to quay.io/3scale
if: ${{ env.NEW_RELEASE != '' }}
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Push new images
if: ${{ env.NEW_RELEASE != '' }}
run: TAG=${NEW_RELEASE:-latest} make push-all-release

- name: Create a new draft-release in github
if: ${{ env.NEW_RELEASE != '' }}
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.NEW_RELEASE }}"
title: "${{ env.NEW_RELEASE }}"
draft: true
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

.PHONY: help

TAG ?= build
TAG ?= 4.4.5
CI_TAG ?= ci
HUB ?= quay.io/3scale
IMAGE ?= quay.io/3scale/soyuz
Expand All @@ -11,6 +11,9 @@ help:
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
| egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | sort

get-new-release:
@hack/new-release.sh v$(TAG)

build-all-release: build build-$(CI_TAG)

push-all-release: push push-$(CI_TAG)
Expand Down
11 changes: 11 additions & 0 deletions hack/new-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

REPO="3scale-ops/soyuz"

# Skip if alpha release
[[ ${1} == *"-alpha"* ]] && echo "" && exit 0

# Skip if release already exists
curl -o /dev/null --fail --silent "https://api.github.com/repos/${REPO}/releases/tags/${1}" && echo "" && exit 0

echo ${1}

0 comments on commit 635dbea

Please sign in to comment.