Skip to content

Commit

Permalink
add release, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnuj committed Mar 28, 2023
1 parent 79dda40 commit c860137
Show file tree
Hide file tree
Showing 4 changed files with 298 additions and 1,446 deletions.
96 changes: 56 additions & 40 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,35 @@
name: default
name: docker-build

on:
push:
pull_request:
branches:
- main
- develop
- test
push:
branches:
- main
- test
tags:
- 'v*'

jobs:
# integration:
# runs-on: ubuntu-latest

# container: "node:16"

# steps:
# - uses: actions/checkout@v2

# - name: Audit
# run: npm audit
delivery:
build:
runs-on: ubuntu-latest
# needs: integration

if: github.ref == 'refs/heads/main' && github.event_name == 'push'
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# https://docs.docker.com/build/ci/github-actions/multi-platform/
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand All @@ -49,19 +42,42 @@ jobs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

# - name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Log in to the github container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build, tag, and push docker image to AWS ECR
uses: docker/build-push-action@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
push: true
github-token: ${{ secrets.GITHUB_TOKEN }}
images: |
${{ steps.login-ecr.outputs.registry }}/fcd
ghcr.io/${{ github.repository }}
terraformlabs/fcd
tags: |
${{ steps.login-ecr.outputs.registry }}/fcd:${{ github.sha }}
${{ steps.login-ecr.outputs.registry }}/fcd:latest
# terramoney/fcd:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
type=sha
type=edge,branch=test
type=semver,pattern={{tag}}
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build docker image
uses: docker/build-push-action@v3
with:
push: ${{ github.event_name != 'pull_request' }}
file: Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }}
labels: ${{ env.DOCKER_METADATA_OUTPUT_LABELS }}

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

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # Push events to matching v*, i.e. v1.0, v20.15.10
- 'v[0-9]+.[0-9]+.[0-9]+-rc*' # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5

jobs:
artifacts:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set version tag
run: echo "VERSION=$(echo ${{github.ref_name}} | sed 's/^v//')" >> $GITHUB_ENV

- name: Create build directory
run: mkdir -p build/release

- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
tag_name: ${{github.ref_name}}
body: ${{steps.github_release.outputs.changelog}}
files: |
build/release/*
Loading

0 comments on commit c860137

Please sign in to comment.