Skip to content

Commit

Permalink
feat: automate dist upload
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed Mar 9, 2023
1 parent c50789c commit c9bc01b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 33 deletions.
33 changes: 18 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

name: CI
name: 🔍 Continuous integration

on: # yamllint disable-line rule:truthy
push:
Expand All @@ -27,15 +27,18 @@ jobs:
node_version: [ 'lts', '19', '18' ]
os_name: [ 'alpine' ]
steps:
- uses: e1himself/goss-installation-action@v1.1.0
- name: 📦 Install goss
uses: e1himself/goss-installation-action@v1.1.0

- name: Checkout
uses: actions/checkout@v3.3.0
- name: 📦 Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Generate dist files
- name: 🤖 Generate dist files
run: make generate

- name: Set Environment Variables
- name: 🌎 Set environment variables
env:
IMAGE_NAMESPACE: wayofdev/node
TEMPLATE: ${{ matrix.node_version }}-${{ matrix.os_name }}
Expand All @@ -45,7 +48,7 @@ jobs:
echo "TEMPLATE=${TEMPLATE}" >> $GITHUB_ENV
echo "VERSION=${RELEASE_VERSION:1}" >> $GITHUB_ENV
- name: Docker Meta
- name: 🐳 Define docker meta
id: meta
uses: docker/metadata-action@v4
with:
Expand All @@ -59,35 +62,35 @@ jobs:
latest=false
prefix=${{ matrix.node_version }}-${{ matrix.os_name }}-
- name: Login to DockerHub
- name: 🔑 Login to docker-hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

### For Cross Platform OSX builds uncomment these lines
- name: Set up QEMU
- name: 🖥️ Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Set up Docker BuildX
- name: 🚀 Set up Docker BuildX
uses: docker/setup-buildx-action@v2
with:
install: true

- name: Set tag for Docker Release Image
- name: 🏷️ Set tag for docker release image
if: success() && startsWith(github.ref, 'refs/tags/')
run: |
echo "IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-${{ env.VERSION }}" >> $GITHUB_ENV
- name: Set tag for Docker Master Image
- name: 🏷️ Set tag for docker master image
if: success() && ! startsWith(github.ref, 'refs/tags/')
run: |
echo "IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest" >> $GITHUB_ENV
- name: Build and Export to Docker
- name: 🛠️ Build and export to docker
uses: docker/build-push-action@v4
with:
context: ./dist/${{ env.TEMPLATE }}
Expand All @@ -97,11 +100,11 @@ jobs:
cache-to: type=inline
labels: ${{ steps.meta.outputs.labels }}

- name: Test Docker Image
- name: 🧪 Test docker image
run: |
export IMAGE_TAG=${{ env.IMAGE_TAG }}; make test
- name: Push Docker Image
- name: 📤 Push docker image
uses: docker/build-push-action@v4
with:
context: ./dist/${{ env.TEMPLATE }}
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on: # yamllint disable-line rule:truthy
branches:
- master

name: release-please
name: 📦 Create release

jobs:
release-please:
Expand All @@ -18,12 +18,6 @@ jobs:
with:
fetch-depth: 0

- name: 🚀 Generate dist files
run: make generate

- name: 🗜️ Archive dist files
run: tar -czvf dist.tar.gz dist

- name: 🎉 Create release
uses: google-github-actions/release-please-action@v3
id: release
Expand All @@ -48,10 +42,4 @@ jobs:
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
]
- name: 📤 Upload release assets
uses: actions/upload-artifact@v3
with:
name: Dockerfiles
path: dist.tar.gz

...
10 changes: 5 additions & 5 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---

name: Differential ShellCheck

on: # yamllint disable-line rule:truthy
pull_request:

name: 🐞 Differential shell-check

permissions:
contents: read

Expand All @@ -13,12 +13,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Repository checkout
uses: actions/checkout@v3.3.0
- name: 📦 Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Differential ShellCheck
- name: 🐞 Differential shell-check
uses: redhat-plumbers-in-action/differential-shellcheck@v4
with:
severity: warning
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/upload-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---

# https://github.com/google-github-actions/release-please-action#release-types-supported

on: # yamllint disable-line rule:truthy
push:
tags:
- "v*.*.*"

name: 📤 Upload artifacts

jobs:
upload-artifacts:
runs-on: ubuntu-latest
steps:
- name: 📦 Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 🚀 Generate dist files
run: make generate

- name: 🗜️ Archive dist files
run: tar -czvf dist.tar.gz dist

- name: 📤 Upload release assets
uses: alexellis/upload-assets@0.4.0
with:
asset_paths: '["./dist.tar.gz"]'

...

0 comments on commit c9bc01b

Please sign in to comment.