Skip to content

Release Candidate v1.2.3 (#185) #51

Release Candidate v1.2.3 (#185)

Release Candidate v1.2.3 (#185) #51

Workflow file for this run

name: Build Release
on:
push:
branches:
- release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 100
- name: Print build name
run: echo "$GITHUB_ACTOR is building '$GITHUB_REPOSITORY' (commit $GITHUB_SHA)"
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.m2/repository
key: ${{ runner.os }}-dependency-cache
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
server-id: github
settings-path: ${{ github.workspace }}
- name: Run KtLint
run: ./gradlew ktlintCheck
- name: Run OpenAPI validation
run: |
npm install -g --force @redocly/cli
echo "Validating API docs..."
redocly lint \
--skip-rule=operation-4xx-response \
--skip-rule=security-defined \
--format=stylish \
src/main/resources/static/docs/open-api/*.yaml
redocly stats \
--format=stylish \
src/main/resources/static/docs/open-api/consumer.yaml
redocly stats \
--format=stylish \
src/main/resources/static/docs/open-api/creator.yaml
- name: Pull latest IP Geolocation data
env:
IP_2_LOCATION_TOKEN: ${{ secrets.IP_2_LOCATION_TOKEN }}
run: ./scripts/pull_ip_geo.sh
- name: Build and test service
env:
BUILD_QUALITY: "GA"
run: ./gradlew build
- name: Codacy Coverage Report
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: bash <(curl -Ls https://coverage.codacy.com/get.sh)
- name: Build Docker image
run: docker build . --file Dockerfile --tag service
- name: Auth for GitHub's Docker repository
env:
USER: ${{ secrets.PACKAGES_USER }}
TOKEN: ${{ secrets.PACKAGES_TOKEN }}
run: docker login docker.pkg.github.com -u $USER -p $TOKEN
- name: Tag Docker image
run: |
VERSION=$(scripts/prop.sh version)
echo "Tagging images with version '$VERSION'..."
docker tag service docker.pkg.github.com/$GITHUB_REPOSITORY/service:$VERSION
docker tag service docker.pkg.github.com/$GITHUB_REPOSITORY/service:latest
docker tag service appifyhub/service:$VERSION
docker tag service appifyhub/service:latest
- name: Publish Docker images to GitHub
run: |
VERSION=$(scripts/prop.sh version)
echo "Publishing images with version '$VERSION'..."
docker push docker.pkg.github.com/$GITHUB_REPOSITORY/service:$VERSION
docker push docker.pkg.github.com/$GITHUB_REPOSITORY/service:latest
- name: Publish Docker images to DockerHub
env:
USER: ${{ secrets.DOCKER_HUB_USER }}
TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
run: |
VERSION=$(scripts/prop.sh version)
docker login docker.io -u $USER -p $TOKEN
echo "Publishing images with version '$VERSION'..."
docker push appifyhub/service:$VERSION
docker push appifyhub/service:latest
- name: Publish to GitHub Releases
env:
BUILD_QUALITY: "GA"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew githubRelease
- name: Deploy to production
env:
DEPLOY_API: ${{ secrets.DEPLOY_API }}
DEPLOY_APP: ${{ secrets.DEPLOY_APP }}
DEPLOY_ARGS: ${{ secrets.DEPLOY_ARGS }}
DEPLOY_SPACE_PROD: ${{ secrets.DEPLOY_SPACE_PROD }}
DEPLOY_AUTH_PROD: ${{ secrets.DEPLOY_AUTH_PROD }}
DEPLOY_MODE: ${{ secrets.DEPLOY_MODE }}
DEPLOY_SPEC: ${{ secrets.DEPLOY_SPEC }}
DEPLOY_TAGS: ${{ secrets.DEPLOY_TAGS }}
run: |
CMD="${DEPLOY_SPEC}$(date +'%s')${DEPLOY_TAGS}"
URL_PROD="${DEPLOY_API}/${DEPLOY_SPACE_PROD}/deployments/${DEPLOY_APP}?${DEPLOY_ARGS}"
curl -s --location --request PATCH "${URL_PROD}" --insecure \
--header "${DEPLOY_MODE}" \
--header "${DEPLOY_AUTH_PROD}" \
--data-raw "${CMD}" \
> /dev/null