diff --git a/.dockerignore b/.dockerignore index d664a74..af43894 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,9 @@ -audiotheker +build/ LICENSE README.md -Dockerfile +CHANGELOG.md +Dockerfile.* Makefile .gitignore -.dockerignore \ No newline at end of file +.dockerignore +.github/ 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 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/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 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..68b4199 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 ``` @@ -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 ```