Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add release workflow #28

Merged
merged 1 commit into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,3 @@ jobs:

- name: run pytest
run: pytest -v -s --color yes tests/

- name: Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'a') }}
with:
draft: true
prerelease: true
files: privoxy-blocklist.sh
generate_release_notes: true

- name: Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
draft: ${{ contains(github.ref, 'a') }}
prerelease: ${{ contains(github.ref, 'a') || contains(github.ref, 'rc') }}
files: privoxy-blocklist.sh
generate_release_notes: true
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
# yamllint disable rule:line-length
name: "Release"

"on":
push:
branches: [main]
tags:
# life version e.g., 0.4.0
- '[0-9]+.[0-9]+.[0-9]+'
# alpha version e.g., 0.4.0-a
- '[0-9]+.[0-9]+.[0-9]+-a'
# release candidate e.g., 0.4.0-rc
- '[0-9]+.[0-9]+.[0-9]+-rc'
workflow_dispatch:

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
actions: read
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Update version
run: sed -i "s/<main>/${GITHUB_REF_NAME}/" privoxy-blocklist.sh

- name: Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'a') }}
with:
draft: true
prerelease: true
files: privoxy-blocklist.sh
generate_release_notes: true

- name: Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
draft: ${{ contains(github.ref, 'a') }}
prerelease: ${{ contains(github.ref, 'a') || contains(github.ref, 'rc') }}
files: privoxy-blocklist.sh
generate_release_notes: true
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,30 @@ Due to this behaviour the script must run as root user to be able to modify the

Either run `privoxy-blocklist.sh` manually with root privileges (e.g., `sudo privoxy-blocklist.sh`) or via root cronjob.

## Tests
## Development

### Release

The release process is automated via github action [Release](https://github.com/Andrwe/privoxy-blocklist/actions/workflows/release.yml) and triggered by pushing a tag to the `main` branch.

The following tags are recognized:

| Tag-Schema | Result |
| ---------- | ------ |
| `[0-9]+.[0-9]+.[0-9]+` | create public release e.g., 0.4.0 |
| `[0-9]+.[0-9]+.[0-9]+-a` | create private alpha release e.g., 0.4.0-a (only visible to collaborators) |
| `[0-9]+.[0-9]+.[0-9]+-rc` | create public release candidate e.g., 0.4.0-rc (pre-release) |

### Tests

Code changes must be tested to ensure that all functionality is working as intended.
For that a pytest based test suite is maintained and runs on every pull request within [Gitlab Actions](https://github.com/Andrwe/privoxy-blocklist/actions).

### Run Local Tests
#### Run Local Tests

The test suite is designed to run within a docker container based on the definition of this repository.
It is currently only tested on Ubuntu Linux but should work on every system with a POSIX compliant shell and docker.

#### Docker

For this method you only require docker to be installed and the permission to run docker containers with volume mounts.

To start all tests of the test suite just run:
```
./tests/run.sh
Expand Down
2 changes: 1 addition & 1 deletion privoxy-blocklist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Author: Andrwe Lord Weber
# Mail: lord-weber-andrwe <at> andrwe <dot> org
# Version: 0.4
# Version: <main>
# URL: http://andrwe.dyndns.org/doku.php/scripting/bash/privoxy-blocklist
#
##################
Expand Down