Skip to content

Commit

Permalink
[change] Updated Makefile to use "edge" label by default #351
Browse files Browse the repository at this point in the history
Added workflow for tagging images with version on release

Closes #351
  • Loading branch information
pandafy committed Sep 18, 2024
1 parent 65116e3 commit a63c7fa
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Versioned release

on:
release:
types:
- published
- edited

jobs:
build:
name: CI Build
runs-on: ubuntu-22.04
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup testing environment
run: |
sudo pip3 install -r requirements-test.txt
- name: Build Images
run: make compose-build nfs-build

# the following action is equivalent to
# echo "$DOCKER_HUB_SECRET" | docker login --username "$DOCKER_HUB_USERNAME" --password-stdin
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_SECRET }}

- name: Release to Docker Hub
run: |
make release USER=docker.io/openwisp
- name: Login to GitLab Container Registry
uses: docker/login-action@v3
with:
registry: registry.gitlab.com
username: ${{ secrets.GITLAB_DOCKER_REGISTRY_USER }}
password: ${{ secrets.GITLAB_DOCKER_REGISTRY_TOKEN }}

- name: Release to GitLab Container Registry
run: |
make release SKIP_BUILD=true
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Find documentation in README.md under
# the heading "Makefile Options".

OPENWISP_VERSION = 24.09.0a
SHELL := /bin/bash
.SILENT: clean pull start stop

default: compose-build

USER = registry.gitlab.com/openwisp/docker-openwisp
TAG = latest
TAG = edge
SKIP_PULL ?= false
SKIP_BUILD ?= false
SKIP_TESTS ?= false
Expand All @@ -18,7 +19,7 @@ pull:
for image in 'openwisp-base' 'openwisp-nfs' 'openwisp-api' 'openwisp-dashboard' \
'openwisp-freeradius' 'openwisp-nginx' 'openwisp-openvpn' 'openwisp-postfix' \
'openwisp-websocket' ; do \
docker pull --quiet $(USER)/$${image}:$(TAG) &> /dev/null; \
docker pull --quiet $(USER)/$${image}:$(TAG); \
docker tag $(USER)/$${image}:$(TAG) openwisp/$${image}:latest; \
done

Expand Down Expand Up @@ -111,3 +112,7 @@ publish:
docker push $(USER)/$${image}:$(TAG); \
docker rmi $(USER)/$${image}:$(TAG); \
done

release:
make publish TAG=latest SKIP_TESTS=true
make publish TAG=$(OPENWISP_VERSION) SKIP_BUILD=true SKIP_TESTS=true

0 comments on commit a63c7fa

Please sign in to comment.