Skip to content

Commit

Permalink
Merge pull request #16 from sinamics/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
sinamics authored Apr 2, 2023
2 parents a4bd943 + 7bb6884 commit a54511a
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 21 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/ci-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Build new docker image when a new tag is pushed, and generate changelog and release notes and use the tag as the release name.
# if the tag has beta or alfa in the name, set the release as a pre-release.

name: Push Tag build container

on:
push:
tags:
- "v*"

# trigger workflow manually
workflow_dispatch:
inputs:
version:
description: "Release version (e.g. v0.0.2)"
required: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Create short sha
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV

- name: Bump version and push tag
uses: anothrNick/[email protected] # Don't use @master unless you're happy to test the latest version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true

- name: "Get Previous tag"
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"

- name: Extract version number
id: extract_version
run: |
echo "raw_tag=${{ steps.previoustag.outputs.tag }}"
version_number="${{ steps.previoustag.outputs.tag }}"
if [[ ${version_number:0:1} == "v" ]]; then
version_number=${version_number:1}
fi
echo "version_number=$version_number"
echo "::set-output name=version_number::$version_number"
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:latest
${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ steps.extract_version.outputs.version_number }}
tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: main

- name: "Get Previous tag"
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alfa') }}
automatic_release_tag: ${{ github.event.inputs.version || steps.previoustag.outputs.tag }}
title: ${{ steps.previoustag.outputs.tag }}
files: |
README.md
18 changes: 1 addition & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# Build new docker image when a new tag is pushed, and generate changelog and release notes and use the tag as the release name.
# if the tag has beta or alfa in the name, set the release as a pre-release.

name: Build Release Image
name: Auto create Tag and container

on:
push:
tags:
- "v*"
pull_request:
types:
- closed
branches:
- main

# trigger workflow manually
workflow_dispatch:
inputs:
version:
description: "Release version (e.g. v0.0.2)"
required: true

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -54,12 +44,6 @@ jobs:
DEFAULT_BUMP: patch
# DRY_RUN: true

# get the previous created tag from anothrNick/[email protected]

# - name: "Get Previous tag"
# id: previoustag
# uses: "WyriHaximus/github-action-get-previous-tag@v1"

- name: Extract version number
id: extract_version
run: |
Expand Down
2 changes: 1 addition & 1 deletion src/components/modules/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Header = () => {
<div className="ml-10 hidden md:inline-flex">
<a href="#" className="inline-flex flex-row items-center">
<span className="ml-1 text-2xl font-bold uppercase leading-10 text-accent">
UAVnet
{process.env.NEXT_PUBLIC_SITE_NAME || "Next ZTnet"}
</span>
</a>
</div>
Expand Down
6 changes: 4 additions & 2 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ const Home: NextPage<{ auth: User }> = ({ auth }) => {
return (
<>
<Head>
<title>UAVnet</title>
<title> {process.env.NEXT_PUBLIC_SITE_NAME || "Next ZTnet"}</title>
<meta name="description" content="Generated by create-t3-app" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main className="flex min-h-screen flex-col">
{/* Header */}
<div className="mx-auto flex w-4/6">
<div>
<h1 className="mb-3 text-5xl font-bold">uavnet</h1>
<h1 className="mb-3 text-5xl font-bold">
{process.env.NEXT_PUBLIC_SITE_NAME || "Next ZTnet"}
</h1>
</div>
{!auth ? (
<div className="m-3 mx-0 flex w-10/12 justify-end">
Expand Down
4 changes: 3 additions & 1 deletion src/pages/network/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const Networks: NextPageWithLayout = () => {
return (
<>
<Head>
<title>UAVnet - Networks</title>
<title>
{process.env.NEXT_PUBLIC_SITE_NAME || "Next ZTnet"} - Networks
</title>
<meta name="description" content="UAV vpn Networks" />
<link rel="icon" href="/favicon.ico" />
</Head>
Expand Down

0 comments on commit a54511a

Please sign in to comment.