Skip to content

Commit

Permalink
feat: add tvos17 support
Browse files Browse the repository at this point in the history
  • Loading branch information
bitxeno committed Jun 22, 2024
1 parent 599d333 commit 0681174
Show file tree
Hide file tree
Showing 14 changed files with 384 additions and 227 deletions.
95 changes: 0 additions & 95 deletions .github/workflows/beta.yml

This file was deleted.

19 changes: 10 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@ jobs:
build:
strategy:
matrix:
go_version: [1.18.x]
go_version: [1.21.x]

runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go_version }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: "16"
- uses: actions/checkout@v3
node-version: "20"
- uses: actions/checkout@v4
- name: build frontend
run: cd ./view && npm install && npm run build
- uses: golangci/golangci-lint-action@v3
run: cd ./web/static && npm install && npm run build
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.53.2
args: --out-format=colored-line-number --timeout=5m
version: v1.58
args: --timeout=5m
- run: go mod download
# - run: go test -coverprofile=coverage.txt -covermode=atomic ./...
- run: go test -coverprofile=coverage.txt -covermode=atomic ./...
8 changes: 4 additions & 4 deletions .github/workflows/clean_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ name: "🗑️ Clean Package"

# Controls when the workflow will run
on:
schedule:
- cron: "0 0 1 * *" # the first day of the month
# schedule:
# - cron: "0 0 * * 1" # the first day of the week

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -28,8 +28,8 @@ jobs:
uses: snok/container-retention-policy@v2
with:
image-names: ${{steps.vars.outputs.APP_NAME}}
cut-off: A week ago UTC
cut-off: A month ago UTC
keep-at-least: 10
skip-tags: latest
skip-tags: latest, beta, alpha, main, master
account-type: personal
token: ${{ secrets.PAT }}
6 changes: 3 additions & 3 deletions .github/workflows/issue_close_inactive.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "🚫 Close Inactive"

on:
schedule:
- cron: "0 0 * * 1"
# schedule:
# - cron: "0 0 * * 1" # the first day of the week
workflow_dispatch:

jobs:
Expand All @@ -20,4 +20,4 @@ jobs:
days-before-stale: 30
days-before-close: 0
days-before-pr-stale: -1
days-before-pr-close: -1
days-before-pr-close: -1
192 changes: 192 additions & 0 deletions .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
name: "🚀 Release Nightly"

# on events
on:
# schedule:
# - cron: '0 0 * * *' # runs daily at 00:00
workflow_dispatch:
# push:
# branches: [main, master, release/v*]

# jobs
jobs:
check:
name: Check has new commits today
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
new_commit_count: ${{steps.commit_check.outputs.new_commit_count}}
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Check for new commits
id: commit_check
run: echo "new_commit_count=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_OUTPUT

build:
name: Generate cross-platform builds
if: ${{needs.check.outputs.new_commit_count > 0}}
needs: [check]
permissions:
contents: write
strategy:
matrix:
go_version: [1.21.x]
runs-on: ubuntu-latest
outputs:
VERSION: ${{steps.vars.outputs.VERSION}}
BUILDDATE: ${{steps.vars.outputs.BUILDDATE}}
COMMIT: ${{steps.vars.outputs.COMMIT}}
APP_NAME: ${{steps.vars.outputs.APP_NAME}}
PUSH_DOCKERHUB: ${{steps.vars.outputs.PUSH_DOCKERHUB}}
steps:
# step 1: checkout repository code
- name: Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 0

# step 2: setup build envirement
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go_version }}
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# step 3: set workflow variables
- id: metadata
uses: ahmadnassri/action-metadata@v2
- name: Initialize workflow environments variables
id: vars
run: |
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "BUILDDATE=$(date '+%F-%T')" >> $GITHUB_OUTPUT
echo "COMMIT=$(git rev-parse --verify HEAD)" >> $GITHUB_OUTPUT
echo "APP_NAME=${{ steps.metadata.outputs.repository_name }}" >> $GITHUB_OUTPUT
echo "REPO=$(echo 'github.com/${{ github.repository }}')" >> $GITHUB_OUTPUT
echo "BRANCH=${{ steps.metadata.outputs.repository_default_branch }}" >> $GITHUB_OUTPUT
if [ ! -z $DOCKER_TOKEN ]; then echo "PUSH_DOCKERHUB=1" >> $GITHUB_OUTPUT; fi
env:
DOCKER_TOKEN: "${{ secrets.DOCKER_TOKEN }}"

# step 4: generate build files
- name: build frontend
run: cd ./web/static && npm install && npm run build
- name: Generate build files
uses: crazy-max/ghaction-xgo@v2
env:
CGO_ENABLED: "0"
with:
xgo_version: latest
go_version: ${{ matrix.go_version }}
dest: build
prefix: ${{steps.vars.outputs.APP_NAME}}
targets: windows/386,windows/amd64,linux/386,linux/amd64,darwin/386,darwin/amd64,linux/386,linux/arm64
v: true
x: false
ldflags: -w -s -X ${{steps.vars.outputs.REPO}}/internal/app/build.Version=${{steps.vars.outputs.VERSION}} -X ${{steps.vars.outputs.REPO}}/internal/app/build.BuildDate=${{steps.vars.outputs.BUILDDATE}} -X ${{steps.vars.outputs.REPO}}/internal/app/build.Commit=${{steps.vars.outputs.COMMIT}} -X ${{steps.vars.outputs.REPO}}/internal/app/build.Mode=production

# step 5: Upload binary to artifact
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{steps.vars.outputs.APP_NAME}}
path: build
retention-days: 1

dockerhub:
name: Push to DockerHub
if: ${{needs.build.outputs.PUSH_DOCKERHUB}}
needs: [build]
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{needs.build.outputs.APP_NAME}}
path: build
- name: Login to DockerHub
if: ${{ steps.vars.outputs.HAS_DOCKER_TOKEN }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}
- name: Build and push Docker images to DockerHub
if: ${{ steps.vars.outputs.HAS_DOCKER_TOKEN }}
uses: docker/build-push-action@v5
with:
context: .
push: true
provenance: false
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
APP_NAME=${{needs.build.outputs.APP_NAME}}
VERSION=${{needs.build.outputs.VERSION}}
BUILDDATE=${{needs.build.outputs.BUILDDATE}}
COMMIT=${{needs.build.outputs.COMMIT}}
ghcr:
name: Push to GitHub Container Registry
needs: [build]
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{needs.build.outputs.APP_NAME}}
path: build
- name: Display structure of downloaded files
run: ls -R
working-directory: build
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push Docker images to ghci
uses: docker/build-push-action@v5
with:
context: .
push: true
provenance: false
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
APP_NAME=${{needs.build.outputs.APP_NAME}}
VERSION=${{needs.build.outputs.VERSION}}
BUILDDATE=${{needs.build.outputs.BUILDDATE}}
COMMIT=${{needs.build.outputs.COMMIT}}
Loading

0 comments on commit 0681174

Please sign in to comment.