Skip to content

Commit ac2f152

Browse files
author
Greg Junge
authored
add release, update deps (#31)
1 parent 69a126f commit ac2f152

File tree

4 files changed

+305
-1446
lines changed

4 files changed

+305
-1446
lines changed

.github/workflows/default.yml

+63-40
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,35 @@
1-
name: default
1+
name: docker-build
22

33
on:
4-
push:
54
pull_request:
65
branches:
76
- main
8-
- develop
7+
- test
8+
push:
9+
branches:
10+
- main
11+
- test
12+
tags:
13+
- 'v*'
914

1015
jobs:
11-
# integration:
12-
# runs-on: ubuntu-latest
13-
14-
# container: "node:16"
15-
16-
# steps:
17-
# - uses: actions/checkout@v2
18-
19-
# - name: Audit
20-
# run: npm audit
21-
delivery:
16+
build:
2217
runs-on: ubuntu-latest
23-
# needs: integration
24-
25-
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
18+
permissions:
19+
contents: read
20+
packages: write
2621

2722
steps:
28-
- uses: actions/checkout@v2
23+
- name: Checkout
24+
uses: actions/checkout@v3
2925

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

33-
- name: Cache Docker layers
34-
uses: actions/cache@v2
35-
with:
36-
path: /tmp/.buildx-cache
37-
key: ${{ runner.os }}-buildx-${{ github.sha }}
38-
restore-keys: |
39-
${{ runner.os }}-buildx-
30+
# Workaround: https://github.com/docker/build-push-action/issues/461
31+
- name: Setup Docker buildx
32+
uses: docker/setup-buildx-action@v2
4033

4134
- name: Configure AWS credentials
4235
uses: aws-actions/configure-aws-credentials@v1
@@ -49,19 +42,49 @@ jobs:
4942
id: login-ecr
5043
uses: aws-actions/amazon-ecr-login@v1
5144

52-
# - name: Login to DockerHub
53-
# uses: docker/login-action@v1
54-
# with:
55-
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
56-
# password: ${{ secrets.DOCKER_HUB_PASSWORD }}
45+
- name: Log in to the github container registry
46+
uses: docker/login-action@v2
47+
with:
48+
registry: ghcr.io
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
5751

58-
- name: Build, tag, and push docker image to AWS ECR
59-
uses: docker/build-push-action@v2
52+
# https://github.com/docker/login-action
53+
- name: Login to DockerHub
54+
uses: docker/login-action@v2
6055
with:
61-
push: true
56+
username: ${{ secrets.DOCKERHUB_USER }}
57+
password: ${{ secrets.DOCKERHUB_TOKEN }}
58+
59+
- name: Extract metadata (tags, labels) for Docker
60+
id: meta
61+
uses: docker/metadata-action@v4
62+
with:
63+
github-token: ${{ secrets.GITHUB_TOKEN }}
64+
images: |
65+
${{ steps.login-ecr.outputs.registry }}/fcd
66+
ghcr.io/${{ github.repository }}
67+
terraformlabs/fcd
6268
tags: |
63-
${{ steps.login-ecr.outputs.registry }}/fcd:${{ github.sha }}
64-
${{ steps.login-ecr.outputs.registry }}/fcd:latest
65-
# terramoney/fcd:latest
66-
cache-from: type=local,src=/tmp/.buildx-cache
67-
cache-to: type=local,dest=/tmp/.buildx-cache
69+
type=sha
70+
type=edge,branch=test
71+
type=semver,pattern={{tag}}
72+
type=semver,pattern={{version}}
73+
type=raw,value=latest,enable={{is_default_branch}}
74+
75+
- name: Build docker image
76+
uses: docker/build-push-action@v3
77+
with:
78+
push: ${{ github.event_name != 'pull_request' }}
79+
file: Dockerfile
80+
platforms: linux/amd64,linux/arm64
81+
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }}
82+
labels: ${{ env.DOCKER_METADATA_OUTPUT_LABELS }}
83+
84+
on:
85+
push:
86+
pull_request:
87+
branches:
88+
- main
89+
- develop
90+

.github/workflows/release.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
- 'v[0-9]+.[0-9]+.[0-9]+-rc*' # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5
8+
9+
jobs:
10+
artifacts:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Set version tag
18+
run: echo "VERSION=$(echo ${{github.ref_name}} | sed 's/^v//')" >> $GITHUB_ENV
19+
20+
- name: Create build directory
21+
run: mkdir -p build/release
22+
23+
- name: Build Changelog
24+
id: github_release
25+
uses: mikepenz/release-changelog-builder-action@v3
26+
27+
- name: Release
28+
uses: softprops/action-gh-release@v1
29+
if: startsWith(github.ref, 'refs/tags/')
30+
with:
31+
draft: true
32+
tag_name: ${{github.ref_name}}
33+
body: ${{steps.github_release.outputs.changelog}}
34+
files: |
35+
build/release/*

0 commit comments

Comments
 (0)