Skip to content

v0.2.0

v0.2.0 #4

Workflow file for this run

name: Release
on:
release:
types: [released]
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Run tests
run: yarn test
- name: Build app
run: yarn build
- name: Configure AWS Credentials
if: ${{ github.repository == 'swan-io/url-shortener' }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: eu-west-1
- name: Login to Docker Registry
if: ${{ github.repository == 'swan-io/url-shortener' }}
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
- name: Dockerize & Push to Registry
if: ${{ github.repository == 'swan-io/url-shortener' }}
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: |
${{ secrets.DOCKER_REGISTRY }}/url-shortener:preprod-${{ github.sha }}
${{ secrets.DOCKER_REGISTRY }}/url-shortener:preprod-${{ github.ref_name }}
${{ secrets.DOCKER_REGISTRY }}/url-shortener:prod-${{ github.sha }}
${{ secrets.DOCKER_REGISTRY }}/url-shortener:prod-${{ github.ref_name }}
- name: Deploy preprod
if: ${{ github.repository == 'swan-io/url-shortener' }}
run: yarn deploy-ci
env:
TAG: preprod-${{ github.ref_name }}
DEPLOY_SWAN_TOKEN: ${{ secrets.DEPLOY_SWAN_TOKEN }}
DEPLOY_SWAN_REPOSITORY: ${{ secrets.DEPLOY_SWAN_REPOSITORY }}
DEPLOY_GIT_USER: ${{ secrets.DEPLOY_GIT_USER }}
DEPLOY_GIT_EMAIL: ${{ secrets.DEPLOY_GIT_EMAIL }}
DEPLOY_ENVIRONMENT: preprod
DEPLOY_APP_NAME: url-shortener
- name: Deploy prod
if: ${{ github.repository == 'swan-io/url-shortener' }}
run: yarn deploy-ci
env:
TAG: prod-${{ github.ref_name }}
DEPLOY_SWAN_TOKEN: ${{ secrets.DEPLOY_SWAN_TOKEN }}
DEPLOY_SWAN_REPOSITORY: ${{ secrets.DEPLOY_SWAN_REPOSITORY }}
DEPLOY_GIT_USER: ${{ secrets.DEPLOY_GIT_USER }}
DEPLOY_GIT_EMAIL: ${{ secrets.DEPLOY_GIT_EMAIL }}
DEPLOY_ENVIRONMENT: prod
DEPLOY_APP_NAME: url-shortener