Skip to content

Commit

Permalink
Merge pull request #44 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 0.0.4
  • Loading branch information
andyone authored Aug 1, 2024
2 parents 79312e0 + 3e7b3d3 commit 7ecff9e
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 109 deletions.
4 changes: 2 additions & 2 deletions .docker/alpine.docker
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG REGISTRY="docker.io"

## BUILDER #####################################################################

FROM ${REGISTRY}/essentialkaos/golang:alpine3.18 as builder
FROM ${REGISTRY}/essentialkaos/golang:alpine3.20 as builder

WORKDIR /go/src/github.com/essentialkaos/detheme

Expand All @@ -14,7 +14,7 @@ RUN make deps && make all

## FINAL IMAGE #################################################################

FROM ${REGISTRY}/essentialkaos/alpine:3.18
FROM ${REGISTRY}/essentialkaos/alpine:3.20

LABEL org.opencontainers.image.title="detheme" \
org.opencontainers.image.description="SublimeText color theme downgrader (sublime-color-scheme → tmTheme converter)" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Docker Push"
name: CD (Release)

on:
release:
Expand All @@ -19,15 +19,13 @@ permissions:

env:
IMAGE_NAME: ${{ github.repository }}
DOCKER_FILE: alpine

jobs:
Docker:
name: Docker Build & Publish
BuildImage:
name: Image Build & Publish
runs-on: ubuntu-latest

env:
DOCKER_FILE: alpine

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -92,7 +90,7 @@ jobs:
- name: Check if build/rebuild is required
id: build_check
run: |
if [[ "${{github.event_name}}" == "release" ]] ; then
if [[ "$GITHUB_EVENT_NAME" == "release" ]] ; then
echo "build=true" >> $GITHUB_OUTPUT
exit 0
fi
Expand Down Expand Up @@ -135,7 +133,7 @@ jobs:
- name: Build and push Docker images (Docker)
if: ${{ steps.build_check.outputs.build == 'true' }}
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: true
context: .
Expand All @@ -148,7 +146,7 @@ jobs:
- name: Build and push Docker images (GHCR)
if: ${{ steps.build_check.outputs.build == 'true' }}
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: true
context: .
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI (PR)

on:
pull_request:
branches: [master]
workflow_dispatch:
inputs:
force_run:
description: 'Force workflow run'
required: true
type: choice
options: [yes, no]

permissions:
actions: read
contents: read
statuses: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
CI:
uses: ./.github/workflows/ci.yml
secrets: inherit

ImageBuild:
name: Container Image Build Check
runs-on: ubuntu-latest

needs: CI

env:
REGISTRY: ghcr.io

strategy:
matrix:
image: [ 'alpine' ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v3
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
if: ${{ env.DOCKERHUB_USERNAME != '' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
run: |
docker build --build-arg REGISTRY=${REGISTRY} -f .docker/${{matrix.image}}.docker -t ${{matrix.image}} .
- name: Show info about built Docker image
uses: essentialkaos/docker-info-action@v1
with:
image: ${{matrix.image}}
show-labels: true
26 changes: 26 additions & 0 deletions .github/workflows/ci-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI (Push)

on:
push:
branches: [master, develop]
workflow_dispatch:
inputs:
force_run:
description: 'Force workflow run'
required: true
type: choice
options: [yes, no]

permissions:
actions: read
contents: read
statuses: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
CI:
uses: ./.github/workflows/ci.yml
secrets: inherit
75 changes: 3 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
name: CI

on:
push:
branches: [master, develop]
pull_request:
branches: [master]
workflow_dispatch:
inputs:
force_run:
description: 'Force workflow run'
required: true
type: choice
options: [yes, no]
workflow_call:

permissions:
actions: read
contents: read
statuses: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Go:
name: Go
Expand All @@ -43,7 +29,7 @@ jobs:
- name: Download dependencies
run: make deps

- name: Run tests
- name: Build binary
run: make all

Hadolint:
Expand Down Expand Up @@ -72,60 +58,5 @@ jobs:
uses: actions/checkout@v4

- name: Check spelling
continue-on-error: true
uses: crate-ci/typos@master

DockerBuild:
name: Docker Build Check
runs-on: ubuntu-latest

needs: Hadolint

env:
REGISTRY: ghcr.io

strategy:
matrix:
image: [ 'alpine' ]

steps:
- name: Check event type
run: |
if [[ "${{github.event_name}}" != "pull_request" ]] ; then
echo "::notice::Event type is not 'pull_request', all job actions will be skipped"
fi
# This step is a hack for needs+if issue with actions
# More info about issue: https://github.com/actions/runner/issues/491
- name: Checkout
uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request' }}

- name: Login to DockerHub
uses: docker/login-action@v3
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
if: ${{ github.event_name == 'pull_request' && env.DOCKERHUB_USERNAME != '' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: ${{ github.event_name == 'pull_request' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
if: ${{ github.event_name == 'pull_request' }}
run: |
docker build --build-arg REGISTRY=${REGISTRY} -f .docker/${{matrix.image}}.docker -t ${{matrix.image}} .
- name: Show info about built Docker image
uses: essentialkaos/docker-info-action@v1
if: ${{ github.event_name == 'pull_request' }}
with:
image: ${{matrix.image}}
show-labels: true
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<a href="https://kaos.sh/r/detheme"><img src="https://kaos.sh/r/detheme.svg" alt="GoReportCard" /></a>
<a href="https://kaos.sh/l/detheme"><img src="https://kaos.sh/l/ca59d01e7d47014dbf4a.svg" alt="Code Climate Maintainability" /></a>
<a href="https://kaos.sh/b/detheme"><img src="https://kaos.sh/b/b1fa2a1a-3bb3-431c-85c7-6f52cf53cd7d.svg" alt="Codebeat badge" /></a>
<a href="https://kaos.sh/w/detheme/ci"><img src="https://kaos.sh/w/detheme/ci.svg" alt="GitHub Actions CI Status" /></a>
<br/>
<a href="https://kaos.sh/w/detheme/ci"><img src="https://kaos.sh/w/detheme/ci-push.svg" alt="GitHub Actions CI Status" /></a>
<a href="https://kaos.sh/w/detheme/codeql"><img src="https://kaos.sh/w/detheme/codeql.svg" alt="GitHub Actions CodeQL Status" /></a>
<a href="#license"><img src=".github/images/license.svg"/></a>
</p>
Expand All @@ -28,7 +29,7 @@

#### From source

To build the `detheme` from scratch, make sure you have a working Go 1.20+ workspace (_[instructions](https://go.dev/doc/install)_), then:
To build the `detheme` from scratch, make sure you have a working Go 1.21+ workspace (_[instructions](https://go.dev/doc/install)_), then:

```
go install github.com/essentialkaos/detheme@latest
Expand Down Expand Up @@ -87,8 +88,8 @@ detheme --generate-man | sudo gzip > /usr/share/man/man1/detheme.1.gz

| Branch | Status |
|--------|----------|
| `master` | [![CI](https://kaos.sh/w/detheme/ci.svg?branch=master)](https://kaos.sh/w/detheme/ci?query=branch:master) |
| `develop` | [![CI](https://kaos.sh/w/detheme/ci.svg?branch=develop)](https://kaos.sh/w/detheme/ci?query=branch:develop) |
| `master` | [![CI](https://kaos.sh/w/detheme/ci-push.svg?branch=master)](https://kaos.sh/w/detheme/ci-push?query=branch:master) |
| `develop` | [![CI](https://kaos.sh/w/detheme/ci-push.svg?branch=develop)](https://kaos.sh/w/detheme/ci-push?query=branch:develop) |

### Contributing

Expand Down
26 changes: 13 additions & 13 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ import (
"os"
"strings"

"github.com/essentialkaos/ek/v12/fmtc"
"github.com/essentialkaos/ek/v12/fmtutil"
"github.com/essentialkaos/ek/v12/options"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v12/support"
"github.com/essentialkaos/ek/v12/support/deps"
"github.com/essentialkaos/ek/v12/usage"
"github.com/essentialkaos/ek/v12/usage/completion/bash"
"github.com/essentialkaos/ek/v12/usage/completion/fish"
"github.com/essentialkaos/ek/v12/usage/completion/zsh"
"github.com/essentialkaos/ek/v12/usage/man"
"github.com/essentialkaos/ek/v12/usage/update"
"github.com/essentialkaos/ek/v13/fmtc"
"github.com/essentialkaos/ek/v13/fmtutil"
"github.com/essentialkaos/ek/v13/options"
"github.com/essentialkaos/ek/v13/strutil"
"github.com/essentialkaos/ek/v13/support"
"github.com/essentialkaos/ek/v13/support/deps"
"github.com/essentialkaos/ek/v13/usage"
"github.com/essentialkaos/ek/v13/usage/completion/bash"
"github.com/essentialkaos/ek/v13/usage/completion/fish"
"github.com/essentialkaos/ek/v13/usage/completion/zsh"
"github.com/essentialkaos/ek/v13/usage/man"
"github.com/essentialkaos/ek/v13/usage/update"

"github.com/essentialkaos/detheme/converter"
"github.com/essentialkaos/detheme/theme"
Expand All @@ -34,7 +34,7 @@ import (
// Basic utility info
const (
APP = "detheme"
VER = "0.0.3"
VER = "0.0.4"
DESC = "SublimeText color theme downgrader (sublime-color-scheme → tmTheme converter)"
)

Expand Down
2 changes: 1 addition & 1 deletion converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"strings"

"github.com/essentialkaos/detheme/theme"
"github.com/essentialkaos/ek/v12/uuid"
"github.com/essentialkaos/ek/v13/uuid"
)

// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ module github.com/essentialkaos/detheme

go 1.19

require github.com/essentialkaos/ek/v12 v12.126.1
require github.com/essentialkaos/ek/v13 v13.3.1

require (
github.com/essentialkaos/depsy v1.3.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/sys v0.22.0 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk=
github.com/essentialkaos/depsy v1.3.0 h1:CN7bRgBU2jGTHSkg/Sh38eDUn7cvmaTp2sxFt2HpFeU=
github.com/essentialkaos/depsy v1.3.0/go.mod h1:kpiTAV17dyByVnrbNaMcZt2jRwvuXClUYOzpyJQwtG8=
github.com/essentialkaos/ek/v12 v12.126.1 h1:K4tCpu9T3k5Bv6hJ1lmW7Ou0GxjgjBIKRsoZgAGdEhE=
github.com/essentialkaos/ek/v12 v12.126.1/go.mod h1:71IJ7m82hgjrvWnhL+z0vIhguxz47/rfVma5/CeI5Fw=
github.com/essentialkaos/ek/v13 v13.3.1 h1:RcBJrBeEKby4I8386FHYxbVhj3XbJP2SS0uz2AJH+1Q=
github.com/essentialkaos/ek/v13 v13.3.1/go.mod h1:RVf1NpNyK04xkBJ3NTUD1wNLWemY9/naVD4iEVjU2fA=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
4 changes: 2 additions & 2 deletions theme/theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"strconv"
"strings"

"github.com/essentialkaos/ek/v12/color"
"github.com/essentialkaos/ek/v12/jsonutil"
"github.com/essentialkaos/ek/v13/color"
"github.com/essentialkaos/ek/v13/jsonutil"
)

// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down

0 comments on commit 7ecff9e

Please sign in to comment.