From 45b9cef890723e15e0f2d11248d2e069bd6ae044 Mon Sep 17 00:00:00 2001 From: fbngrmr Date: Sun, 15 Jan 2023 17:13:00 +0100 Subject: [PATCH 1/5] chore: Add Linux/macOS/Windows builds to Makefile --- .dockerignore | 2 +- .gitignore | 4 ++-- Makefile | 31 ++++++++++++++++++++++++++++--- README.md | 2 +- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index d664a74..ff81446 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,4 @@ -audiotheker +build/ LICENSE README.md Dockerfile diff --git a/.gitignore b/.gitignore index f6eff0b..6f5ea80 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ go.work # audiotheker binary -audiotheker +build/ # macOS specific files -.DS_Store \ No newline at end of file +.DS_Store diff --git a/Makefile b/Makefile index dc8c8b1..f49ef50 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,33 @@ GOFMT_FILES?=$$(find . -not -path "./vendor/*" -type f -name '*.go') +BUILD_DIR=./build +BIN_NAME=audiotheker + default: run -bin: fmtcheck - CGO_ENABLED=0 go build -o audiotheker -ldflags="-s -w" main.go +release-linux: fmtcheck build-setup bin-linux + tar -czvf $(BUILD_DIR)/$(BIN_NAME).linux-amd64.tar.gz $(BUILD_DIR)/$(BIN_NAME); + +release-darwin: fmtcheck build-setup bin-darwin + tar -czvf $(BUILD_DIR)/$(BIN_NAME).darwin-amd64.tar.gz $(BUILD_DIR)/$(BIN_NAME); + +release-windows: fmtcheck build-setup bin-windows + zip -9 -y $(BUILD_DIR)/$(BIN_NAME).windows-amd64.zip $(BUILD_DIR)/$(BIN_NAME).exe; + +bin-linux: fmtcheck build-setup + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o $(BUILD_DIR)/$(BIN_NAME) -ldflags="-s -w" main.go + +bin-darwin: fmtcheck build-setup + GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o $(BUILD_DIR)/$(BIN_NAME) -ldflags="-s -w" main.go + +bin-windows: fmtcheck build-setup + GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o $(BUILD_DIR)/$(BIN_NAME).exe -ldflags="-s -w" main.go + +bin: fmtcheck build-setup + CGO_ENABLED=0 go build -o $(BUILD_DIR)/audiotheker -ldflags="-s -w" main.go + +build-setup: + mkdir -p $(BUILD_DIR) fmt: gofmt -w $(GOFMT_FILES) @@ -14,4 +38,5 @@ fmtcheck: run: bin ./audiotheker -.PHONY: bin fmt fmtcheck run default + +.PHONY: bin bin-windows bin-darwin bin-linux fmt fmtcheck run default diff --git a/README.md b/README.md index c52e606..7b35b02 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Copy the URL to a program, collection, or an individual episode from your browse ### Built binary ```sh -$ ./audiotheker download \ +$ ./build/audiotheker download \ "https://www.ardaudiothek.de/sendung/j-r-r-tolkien-der-herr-der-ringe-fantasy-hoerspiel-klassiker/12197351/" \ PATH/TO/YOUR/DOWNLOADS ``` From 59d83b5cc0d98484e0e8b07741baa334f1683f9c Mon Sep 17 00:00:00 2001 From: fbngrmr Date: Sun, 15 Jan 2023 17:14:37 +0100 Subject: [PATCH 2/5] chore: Track changes in CHANGELOG --- .dockerignore | 2 +- CHANGELOG.md | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/.dockerignore b/.dockerignore index ff81446..e2e5d2e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ build/ LICENSE README.md -Dockerfile +CHANGELOG.md Makefile .gitignore .dockerignore \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f8352ff --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.2.0] - 2023-01-13 + +### Added +* Feature: Support downloading collections and individual episodes + +## Fixed +* Fix Docker example in `README` (thanks @endresjo) +* Add missing newline when printing errors + +## [0.1.0] - 2023-01-08 + +Initial release \ No newline at end of file From 35746ff34b85e6234d6ae66697c9f62f08449bbe Mon Sep 17 00:00:00 2001 From: fbngrmr Date: Sun, 15 Jan 2023 17:18:53 +0100 Subject: [PATCH 3/5] chore: Install GH workflow for releasing a new version when tagging --- .dockerignore | 3 +- .github/workflows/release.yml | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.dockerignore b/.dockerignore index e2e5d2e..9de248d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,5 @@ README.md CHANGELOG.md Makefile .gitignore -.dockerignore \ No newline at end of file +.dockerignore +.github/ \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..067f929 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: release + +on: + push: + tags: + - '*' + +jobs: + release: + name: Build and release new version + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Build for macOS, Windows, Linux + run: make release-darwin && make release-windows && make release-darwin + - name: Create GitHub release + uses: actions/create-release@v1 + id: create_release + with: + draft: false + prerelease: false + release_name: ${{ github.ref_name }} + tag_name: ${{ github.ref }} + body: HERE BE COOL CHANGELOG + env: + GITHUB_TOKEN: ${{ github.token }} + - name: Add Linux build to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./bin/audiotheker.linux-amd64.tar.gz + asset_name: audiotheker.linux-amd64.tar.gz + asset_content_type: application/gzip + - name: Add macOS build to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./bin/audiotheker.darwin-amd64.tar.gz + asset_name: audiotheker.darwin-amd64.tar.gz + asset_content_type: application/gzip + - name: Add Windows build to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./bin/audiotheker.windows-amd64.zip + asset_name: audiotheker.windows-amd64.zip + asset_content_type: application/zip From 271634d965b7835b11c082c5abb1d4f9cd430cf0 Mon Sep 17 00:00:00 2001 From: fbngrmr Date: Sun, 15 Jan 2023 17:20:00 +0100 Subject: [PATCH 4/5] chore: Ignore Dockerfile in `docker build` --- .dockerignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 9de248d..af43894 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,7 +2,8 @@ build/ LICENSE README.md CHANGELOG.md +Dockerfile.* Makefile .gitignore .dockerignore -.github/ \ No newline at end of file +.github/ From 141b460edc53d5e4dc4581e0a86a9e4be9e56146 Mon Sep 17 00:00:00 2001 From: fbngrmr Date: Sun, 15 Jan 2023 17:20:33 +0100 Subject: [PATCH 5/5] docs: Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b35b02..68b4199 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ $ docker run \ --rm \ --user $(id -u):$(id -g) \ -v PATH/TO/YOUR/DOWNLOADS:/download \ - audiotheker:0.1.0 download \ + audiotheker:0.2.0 download \ "https://www.ardaudiothek.de/sendung/j-r-r-tolkien-der-herr-der-ringe-fantasy-hoerspiel-klassiker/12197351/" \ /download ```