Skip to content

Commit

Permalink
fix: fixed release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleT committed Apr 20, 2020
1 parent 4e077ee commit c12ad64
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 88 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI

on:
push:
branches:
- '**'
tags-ignore:
- '**'

jobs:
build_ilc:
name: Build ILC
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Docker ilc auth
run: echo "${{ secrets.DOCKER_HUB_TOKEN_NC }}" | docker login --username namecheaprnd --password-stdin

- name: Build the Docker image
run: |
cd ./ilc/
docker build . --tag ilc:tmp
- name: Run tests
run: docker run ilc:tmp npm run test

- name: Calc tags
id: tags
run: |
BRANCH=$(echo ${GITHUB_REF} | cut -d '/' -f 3-99)
LATEST=$([ "$BRANCH" == "master" ] && echo "latest,${GITHUB_SHA:0:7}," || echo "")
DOCKER_TAGS="$LATEST${BRANCH//\//_}"
echo "Tags that will be used: $DOCKER_TAGS"
echo ::set-output name=docker_tags::$DOCKER_TAGS
- name: Push image
run: |
TAGS="${{ steps.tags.outputs.docker_tags }}"
for i in ${TAGS//,/ }
do
docker tag ilc:tmp namecheap/ilc:$i
docker push namecheap/ilc:$i
done
build_registry:
name: Build Registry
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Docker registry auth
run: echo "${{ secrets.DOCKER_HUB_TOKEN_NC }}" | docker login --username namecheaprnd --password-stdin

- name: Build the Docker image
run: |
cd ./registry/
docker build . --tag registry:tmp
- name: Run tests
run: docker run registry:tmp npm run test:ci

- name: Calc tags
id: tags
run: |
BRANCH=$(echo ${GITHUB_REF} | cut -d '/' -f 3-99)
LATEST=$([ "$BRANCH" == "master" ] && echo "latest,${GITHUB_SHA:0:7}," || echo "")
DOCKER_TAGS="$LATEST${BRANCH//\//_}"
echo "Tags that will be used: $DOCKER_TAGS"
echo ::set-output name=docker_tags::$DOCKER_TAGS
- name: Push image
run: |
TAGS="${{ steps.tags.outputs.docker_tags }}"
for i in ${TAGS//,/ }
do
docker tag registry:tmp namecheap/ilc_registry:$i
docker push namecheap/ilc_registry:$i
done
41 changes: 0 additions & 41 deletions .github/workflows/ilc.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/registry.yml

This file was deleted.

44 changes: 40 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
- name: Calc tags
id: tags
run: |
function isSemver() {
echo "${1}" | grep -Eq '^refs/tags/v?([0-9]+)\.([0-9+])\.([0-9]+)(-[a-zA-Z]+(\.[0-9]+)?)?$'
}
echo $GITHUB_REF
if ! isSemver "${GITHUB_REF}"; then
echo "Invalid tag name format. Use semver style. Ex: v1.2.3"
exit 1
Expand All @@ -27,10 +32,7 @@ jobs:
echo "Tags that will be used: $DOCKER_TAGS"
echo ::set-output name=docker_tags::$DOCKER_TAGS
function isSemver() {
echo "${1}" | grep -Eq '^refs/tags/v?([0-9]+)\.([0-9+])\.([0-9]+)(-[a-zA-Z]+(\.[0-9]+)?)?$'
}
echo ::set-output name=tag::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Pull & tag images for release
run: |
Expand All @@ -50,3 +52,37 @@ jobs:
docker tag namecheap/ilc_registry:${GITHUB_SHA:0:7} namecheap/ilc_registry:$i
docker push namecheap/ilc_registry:$i
done
- name: Get release description
id: get_release
uses: octokit/request-action@v2.x
with:
route: GET /repos/:repository/releases/tags/:tag_name
repository: ${{ github.repository }}
tag_name: ${{ steps.tags.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Parse release info
id: parse_release
uses: gr2m/get-json-paths-action@v1.x
with:
json: ${{ steps.get_release.outputs.data }}
id: "id"
body: "body"

- uses: octokit/request-action@v2.x
id: update_check_run
with:
route: PATCH /repos/:repository/releases/:release_id
repository: ${{ github.repository }}
release_id: ${{ steps.parse_release.outputs.id }}
body: |
|
${{ steps.parse_release.outputs.body }}
**Docker images:**
- [namecheap/ilc](https://hub.docker.com/r/namecheap/ilc): `${{ steps.tags.outputs.docker_tags }}`
- [namecheap/ilc_registry](https://hub.docker.com/r/namecheap/ilc_registry): `${{ steps.tags.outputs.docker_tags }}`
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
----

[![Demo website](./docs/assets/demo-website.svg)](http://demo.microfrontends.online/)
[![Actions Status](https://github.com/namecheap/ilc/workflows/Registry/badge.svg)](https://github.com/namecheap/ilc/actions)
[![Actions Status](https://github.com/namecheap/ilc/workflows/ILC/badge.svg)](https://github.com/namecheap/ilc/actions)
[![Actions Status](https://github.com/namecheap/ilc/workflows/CI/badge.svg)](https://github.com/namecheap/ilc/actions)
[![Docker Pulls](https://img.shields.io/docker/pulls/namecheap/ilc?logo=docker&logoColor=white)](https://hub.docker.com/r/namecheap/ilc)

Isomorphic Layout Composer (ILC) - layout service that compose a web page from fragment services.
Expand Down

0 comments on commit c12ad64

Please sign in to comment.