Skip to content

Commit

Permalink
Rename package to com.sainsburys.k2zpl, add GitHub package publish ac…
Browse files Browse the repository at this point in the history
…tion.
  • Loading branch information
itsmattking committed Aug 3, 2024
1 parent c16e74c commit fcc597e
Show file tree
Hide file tree
Showing 50 changed files with 188 additions and 146 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/publish-ghp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish package to GitHub Packages
on:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- uses: gradle/gradle-build-action@v3
- name: Publish package
run: ./gradlew publishMavenPublicationToGitHubPackagesRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

runs-on: ubuntu-latest
environment: Release
if: github.repository == 'itsmattking/k2zpl'
if: github.repository == 'sainsburys-tech/k2zpl'

steps:
- name: Checkout
Expand Down
29 changes: 20 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
id("com.vanniktech.maven.publish") version "0.29.0"
}

group = "info.mking.k2zpl"
group = "com.sainsburys.k2zpl"
version = "0.1.0"

repositories {
Expand All @@ -26,20 +26,31 @@ tasks.test {
useJUnitPlatform()
}


publishing {
repositories {
maven("https://maven.pkg.github.com/sainsburys-tech/k2zpl") {
name = "GitHubPackages"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
coordinates("info.mking.k2zpl", "k2zpl", "0.1.0")
coordinates("com.sainsburys.k2zpl", "k2zpl", "0.1.0")
pom {
name.set("k2zpl")
description.set("Kotlin DSL for ZPL (Zebra Programming Language)")
inceptionYear.set("2024")
url.set("https://github.com/itsmattking/k2zpl/")
url.set("https://github.com/sainsburys-tech/k2zpl/")
licenses {
license {
name.set("The Unlicense")
url.set("https://unlicense.org")
distribution.set("https://unlicense.org")
name.set("MIT License")
url.set("https://github.com/sainsburys-tech/k2zpl/blob/main/LICENSE")
}
}
developers {
Expand All @@ -50,9 +61,9 @@ mavenPublishing {
}
}
scm {
url.set("https://github.com/itsmattking/k2zpl/")
connection.set("scm:git:git://github.com/itsmattking/k2zpl.git")
developerConnection.set("scm:git:ssh://[email protected]/itsmattking/k2zpl.git")
url.set("https://github.com/sainsburys-tech/k2zpl/")
connection.set("scm:git:git://github.com/sainsburys-tech/k2zpl.git")
developerConnection.set("scm:git:ssh://[email protected]/sainsburys-tech/k2zpl.git")
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl
package com.sainsburys.k2zpl

import info.mking.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.builder.ZplBuilder

fun k2zpl(init: ZplBuilder.() -> Unit) = ZplBuilder().apply(init).build()
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.builder
package com.sainsburys.k2zpl.builder

import info.mking.k2zpl.command.options.ZplYesNo
import com.sainsburys.k2zpl.command.options.ZplYesNo

internal fun Boolean.toZplYesNo(): ZplYesNo = when (this) {
true -> ZplYesNo.YES
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.builder
package com.sainsburys.k2zpl.builder

import info.mking.k2zpl.command.CustomCommand
import info.mking.k2zpl.command.Font
import info.mking.k2zpl.command.ZplCommand
import info.mking.k2zpl.command.fieldData
import info.mking.k2zpl.command.fieldOrigin
import info.mking.k2zpl.command.fieldSeparator
import info.mking.k2zpl.command.font
import info.mking.k2zpl.command.options.ZplDpiSetting
import info.mking.k2zpl.command.options.ZplFieldOrientation
import info.mking.k2zpl.command.options.ZplFont
import com.sainsburys.k2zpl.command.CustomCommand
import com.sainsburys.k2zpl.command.Font
import com.sainsburys.k2zpl.command.ZplCommand
import com.sainsburys.k2zpl.command.fieldData
import com.sainsburys.k2zpl.command.fieldOrigin
import com.sainsburys.k2zpl.command.fieldSeparator
import com.sainsburys.k2zpl.command.font
import com.sainsburys.k2zpl.command.options.ZplDpiSetting
import com.sainsburys.k2zpl.command.options.ZplFieldOrientation
import com.sainsburys.k2zpl.command.options.ZplFont
import kotlin.math.roundToInt

class ZplBuilder {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import info.mking.k2zpl.builder.toZplYesNo
import info.mking.k2zpl.command.options.ZplBarcodeType
import info.mking.k2zpl.command.options.ZplFieldOrientation
import info.mking.k2zpl.command.options.ZplYesNo
import com.sainsburys.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.builder.toZplYesNo
import com.sainsburys.k2zpl.command.options.ZplBarcodeType
import com.sainsburys.k2zpl.command.options.ZplFieldOrientation
import com.sainsburys.k2zpl.command.options.ZplYesNo

internal data class BarCode(
val type: ZplBarcodeType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

internal data class CustomCommand(override val command: CharSequence) : ZplCommand
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.builder.ZplBuilder

internal data object EndFormat : ZplCommand {
override val command: CharSequence = "^XZ"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import info.mking.k2zpl.command.options.ZplTextAlignment
import com.sainsburys.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.command.options.ZplTextAlignment

internal data class FieldBlock(
val width: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.builder.ZplBuilder

internal data class FieldData(val data: String) : ZplCommand {
override val command: CharSequence = "^FD"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import info.mking.k2zpl.command.options.ZplJustification
import com.sainsburys.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.command.options.ZplJustification

internal data class FieldOrigin(
val x: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.builder.ZplBuilder

internal data object FieldSeparator : ZplCommand {
override val command: CharSequence = "^FS"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import info.mking.k2zpl.command.options.ZplFieldOrientation
import info.mking.k2zpl.command.options.ZplFont
import com.sainsburys.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.command.options.ZplFieldOrientation
import com.sainsburys.k2zpl.command.options.ZplFont

internal data class Font(
val font: ZplFont,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import info.mking.k2zpl.command.options.ZplLineColor
import com.sainsburys.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.command.options.ZplLineColor

internal data class GraphicBox(
val width: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import info.mking.k2zpl.command.options.ZplCompressionType
import com.sainsburys.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.command.options.ZplCompressionType

internal data class GraphicField(
val format: ZplCompressionType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.builder.ZplBuilder

internal data class LabelHome(val x: Int, val y: Int) : ZplCommand {
override val command: CharSequence = "^LH"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.builder.ZplBuilder

internal data class LabelLength(val length: Int) : ZplCommand {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import info.mking.k2zpl.builder.toZplYesNo
import info.mking.k2zpl.command.options.ZplMediaMode
import info.mking.k2zpl.command.options.ZplYesNo
import com.sainsburys.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.builder.toZplYesNo
import com.sainsburys.k2zpl.command.options.ZplMediaMode
import com.sainsburys.k2zpl.command.options.ZplYesNo

internal data class MediaMode(
val mediaMode: ZplMediaMode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.builder.ZplBuilder

internal data class PrintWidth(val width: Int) : ZplCommand {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

import info.mking.k2zpl.builder.ZplBuilder
import com.sainsburys.k2zpl.builder.ZplBuilder

internal data object StartFormat : ZplCommand {
override val command: CharSequence = "^XA"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package info.mking.k2zpl.command
package com.sainsburys.k2zpl.command

interface ZplCommand {
val command: CharSequence
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.command.options
package com.sainsburys.k2zpl.command.options

enum class ZplBarcodeType {
CODE_39
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.command.options
package com.sainsburys.k2zpl.command.options

enum class ZplCompressionType(private val value: Char) {
ASCII('A'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.command.options
package com.sainsburys.k2zpl.command.options

enum class ZplDpiSetting(val dpi: Int, val dotsPerMm: Double) {
Unset(-1, -1.0),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.command.options
package com.sainsburys.k2zpl.command.options

enum class ZplFieldOrientation(val code: Char) {
NORMAL('N'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.command.options
package com.sainsburys.k2zpl.command.options

enum class ZplFont(val code: Char) {
A('A'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.command.options
package com.sainsburys.k2zpl.command.options

enum class ZplJustification(private val value: Char) {
LEFT('0'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.command.options
package com.sainsburys.k2zpl.command.options

enum class ZplLineColor(val code: Char) {
BLACK('B'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.command.options
package com.sainsburys.k2zpl.command.options

enum class ZplMediaMode(val value: Char) {
TEAR_OFF('T'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.command.options
package com.sainsburys.k2zpl.command.options

enum class ZplTextAlignment(val code: Char) {
LEFT('L'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UNUSED")

package info.mking.k2zpl.command.options
package com.sainsburys.k2zpl.command.options

internal enum class ZplYesNo(val value: String) {
YES("Y"),
Expand Down
5 changes: 5 additions & 0 deletions src/test/kotlin/com/sainsburys/k2zpl/Extensions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.sainsburys.k2zpl

import com.sainsburys.k2zpl.command.ZplCommand

fun ZplCommand.testBuildString() = buildString { build(this) }
Loading

0 comments on commit fcc597e

Please sign in to comment.