Skip to content

Commit

Permalink
fix: revert 1.6.0 3rd attempt (#83)
Browse files Browse the repository at this point in the history
* revert: release 1.6.0

This reverts commit 7046f63.

* fix: remove skip to allow tags workflow to trigger

When the tagged commit is added to the repo, we need the docker tags workflow to
create the container images. If we set the ci to skip, then the workflow is not
triggered.

* ci: use a pat to create the release commit and tags

The GITHUB_TOKEN does not allow triggering of workflows. The persisted credentials
from the actions/checkout overrides the env tokens used by semantic release and
therefore these credentials must be purged.

This allows the PAT to create the new version commit and tag to allow the docker
workflow to create the docker images witht he correct release tag versions.

* chore: rename the release drafter to show upcoming commits in a new release

* ci: formatting and do not build images in forked repos

* chore: add copyright and formatting

* ci: continue pr cleanup if jobs fail

Allow the workflow to be cancelled by evaluating failure
  • Loading branch information
bassco committed Dec 5, 2023
1 parent 7046f63 commit 828244e
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 95 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/conventional-label.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# (c) Copyright 2019-2023 OLX

on:
pull_request:
types: [ opened, edited ]
types: [opened, edited]
name: conventional-release-labels
jobs:
label:
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# (c) Copyright 2019-2023 OLX

# This workflow is triggered when semantic-release
# cretes a new tag in the repository.
# A PAT repository secret, SEM_REL_TOKEN, is used to allow
# a new workflow to be triggered, as GITHUB_TOKEN usage does not.

name: post-release

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10

#permissions:
# checks: write

# Only allow one release workflow to execute at a time, since each release
# workflow uses shared resources (git tags, package registries)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
runs-on: ubuntu-latest
name: Publish Images
if: needs.get-next-version.outputs.new-release-published == 'true'
needs:
- get-next-version
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
flavor: latest=true
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=master,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
15 changes: 7 additions & 8 deletions .github/workflows/pr-cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# (c) Copyright 2019-2023 OLX

# Delete Docker images, caches and artifacts after PR merge
name: 'Clean Up PR'
name: "Clean Up PR"

on:
pull_request:
Expand All @@ -9,8 +11,7 @@ on:
jobs:
purge-docker:
name: Delete build artifacts and preview images
strategy:
fail-fast: false
if: success() || failure()
runs-on: ubuntu-latest
steps:
- uses: chipkent/action-cleanup-package@v1.0.3
Expand All @@ -20,18 +21,16 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
purge-artifacts:
name: Delete build artifacts and preview images
strategy:
fail-fast: false
if: success() || failure()
runs-on: ubuntu-latest
steps:
- uses: stefanluptak/delete-old-pr-artifacts@v1
with:
workflow_filename: pull-requests-tests.yml
debug: true
cleanup:
purge-caches:
name: Clean up branch caches
strategy:
fail-fast: false
if: success() || failure()
runs-on: ubuntu-latest
permissions:
# `actions:write` permission is required to delete caches
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/pull-requests-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ jobs:
options: -v ${{ github.workspace }}/tests/resources/:/usr/share/nginx/html/ --name backend
steps:
- name: Debug workflow trigger
run:
echo "The workflow was triggered by ${{ github.triggering_actor }}"
echo -e "The actor is\t${{github.actor}}"
echo -e "The actor has id\t${{github.actor_id}}"
run: |
echo "The workflow was triggered by ${{ github.triggering_actor }}"
echo -e "The actor is\t${{github.actor}}"
echo -e "The actor has id\t${{github.actor_id}}"
- uses: actions/checkout@v4
- name: Restart nginx
uses: docker://docker
with:
args: docker restart backend
- name: Install build dependencies
run: apk add --update --no-cache
run: apk add --update --no-cache
--repository https://dl-cdn.alpinelinux.org/alpine/v3.17/community
--repository https://dl-cdn.alpinelinux.org/alpine/v3.17/main
curl
Expand All @@ -52,7 +52,7 @@ jobs:
vips-heif=8.13.3-r1
tar
- name: Check if nginx is available for files hosting
run: curl http://backend/exif --output /dev/null
run: curl http://backend/exif --output /dev/null
# Cache needs the Cargo.lock file for the cache key and must come after the git checkout
- name: Set up cargo cache
uses: actions/cache@v3
Expand All @@ -67,11 +67,11 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build Dali
run: RUSTFLAGS="-C target-feature=-crt-static $(pkg-config vips --libs)" cargo build
run: RUSTFLAGS="-C target-feature=-crt-static $(pkg-config vips --libs)" cargo build
- name: Run Dali
run: ./target/debug/dali >> /dev/null &
run: ./target/debug/dali >> /dev/null &
- name: Check if Dali is running
run: sleep 5 && nc -z localhost 8080
run: sleep 5 && nc -z localhost 8080
- name: Run tests
run: |
set +e
Expand Down Expand Up @@ -103,15 +103,15 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker metadata
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' && github.repository == 'olxgroup-oss/dali'
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: ${{ github.head_ref }}

- name: Build and push
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' && github.repository == 'olxgroup-oss/dali'
uses: docker/build-push-action@v5
with:
context: .
Expand All @@ -121,7 +121,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}

- name: Add package image comment to PR
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' && github.repository == 'olxgroup-oss/dali'
uses: marocchino/sticky-pull-request-comment@v2
# Inform the user that a preview image has been built and published
with:
Expand Down
File renamed without changes.
34 changes: 3 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

# Install the dependency for @semantic-release/exec
- name: Install semantic-release-cargo
Expand All @@ -41,7 +42,8 @@ jobs:
id: semantic
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.SEM_REL_TOKEN }}
GITHUB_TOKEN: ${{ secrets.SEM_REL_TOKEN }}
GITHUB_USER: ${{ github.repository_owner }}
with:
semantic_version: 22.0.8
Expand All @@ -55,33 +57,3 @@ jobs:
@semantic-release/github@9.2.3
@semantic-release/release-notes-generator@12.1.0
semantic-release-major-tag@0.3.2
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
flavor: latest=true
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=master,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
10 changes: 3 additions & 7 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"branches": [ "master" ],
"branches": ["master"],
"ci": false,
"plugins": [
"@semantic-release/commit-analyzer",
Expand Down Expand Up @@ -34,12 +34,8 @@
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"Cargo.toml",
"Cargo.lock"
],
"message": "chore: Release ${nextRelease.version} [skip ci]"
"assets": ["CHANGELOG.md", "Cargo.toml", "Cargo.lock"],
"message": "chore: v${nextRelease.version} released"
}
]
]
Expand Down
34 changes: 0 additions & 34 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,34 +0,0 @@
# [1.6.0](https://github.com/olxgroup-oss/dali/compare/v1.5.0...v1.6.0) (2023-12-04)


### Bug Fixes

* **deps:** bump num-bigint from 0.4.2 to 0.4.3 ([#18](https://github.com/olxgroup-oss/dali/issues/18)) ([742dfed](https://github.com/olxgroup-oss/dali/commit/742dfed98b45bccf3866e83cc049d03ffbfd8cd0))
* **deps:** remove chrono ([#29](https://github.com/olxgroup-oss/dali/issues/29)) ([e47b3b0](https://github.com/olxgroup-oss/dali/commit/e47b3b040f740bf576709611f5189b69a871ace5))
* **deps:** update rust crate config to 0.13.3 ([#37](https://github.com/olxgroup-oss/dali/issues/37)) ([28b57fe](https://github.com/olxgroup-oss/dali/commit/28b57fe982503040d1ed3ec4e226209d7f5db56f))
* **deps:** update rust crate config to 0.13.4 ([150fdec](https://github.com/olxgroup-oss/dali/commit/150fdec0c5cc484bc0190bcaf54b23ca4a40e3d8))
* **deps:** update rust crate env_logger to 0.10.0 ([2d59d1b](https://github.com/olxgroup-oss/dali/commit/2d59d1b22f8f93a84afa617cbc203ac4bbd6c243))
* **deps:** update rust crate env_logger to 0.10.1 ([49f43b9](https://github.com/olxgroup-oss/dali/commit/49f43b98db851733911fdd4469030273dd92a226))
* **deps:** update rust crate futures to 0.3.29 ([dd6e042](https://github.com/olxgroup-oss/dali/commit/dd6e042c243e6cefdfe4dc65f37868fba2d6b671))
* **deps:** update rust crate hyper to 0.14.27 ([#39](https://github.com/olxgroup-oss/dali/issues/39)) ([0fb375d](https://github.com/olxgroup-oss/dali/commit/0fb375d2688b89436e2f402034e012039c084809))
* **deps:** update rust crate log to 0.4.20 ([36ee5e7](https://github.com/olxgroup-oss/dali/commit/36ee5e767446fd3b44bd3469b256f2a00f3389a4))
* **deps:** update rust crate num_cpus to 1.16.0 ([#42](https://github.com/olxgroup-oss/dali/issues/42)) ([6d1cea8](https://github.com/olxgroup-oss/dali/commit/6d1cea8dbfe9eaa27cb8a6f5d60c8ec256dfba96))
* **deps:** update rust crate prometheus to 0.13.3 ([4569fd7](https://github.com/olxgroup-oss/dali/commit/4569fd7e2917999a933e5b9b8b9dfda3d167ef62))
* **deps:** update rust crate serde_json to 1.0.108 ([b336b26](https://github.com/olxgroup-oss/dali/commit/b336b26dc3d745d9e45d5bd9fc8c0e3b733038c2))
* **deps:** update serde monorepo to 1.0.190 ([9a04b10](https://github.com/olxgroup-oss/dali/commit/9a04b10cf1963715dbda2c2ac8e10373edc4f5f5))
* **deps:** update serde monorepo to 1.0.192 ([3f7f9d5](https://github.com/olxgroup-oss/dali/commit/3f7f9d5f8bef8ee486c314c83d976e1e553061fe))
* **deps:** update serde monorepo to 1.0.193 ([871b6b8](https://github.com/olxgroup-oss/dali/commit/871b6b8d64e5fe0afd1b09666645b25803a95226))
* github action errors ([#64](https://github.com/olxgroup-oss/dali/issues/64)) ([3366377](https://github.com/olxgroup-oss/dali/commit/3366377555fb71873d6cc104d1b1eb129daa54c1))
* preset config failing the releases ([#76](https://github.com/olxgroup-oss/dali/issues/76)) ([a739441](https://github.com/olxgroup-oss/dali/commit/a7394417732ed14d96235318c46548b442102ca0))
* **security:** bump regex from 1.5.4 to 1.5.6 ([#20](https://github.com/olxgroup-oss/dali/issues/20)) ([e6569fe](https://github.com/olxgroup-oss/dali/commit/e6569fea0537bc9091bcd38929a7544ba1e4eb01))


### Features

* **perf:** manually install and configure libvips ([#59](https://github.com/olxgroup-oss/dali/issues/59)) ([8e4e1a1](https://github.com/olxgroup-oss/dali/commit/8e4e1a1d53c62c106a0b9a6c399da21c79c8675b)), closes [#39](https://github.com/olxgroup-oss/dali/issues/39)


### Reverts

* 1.6.0 2nd attempt ([#82](https://github.com/olxgroup-oss/dali/issues/82)) ([025d5ea](https://github.com/olxgroup-oss/dali/commit/025d5ead1515e6e108cadb02c624541f83bcd1e1))
* release 1.6.0 ([718ce48](https://github.com/olxgroup-oss/dali/commit/718ce48d38393ad48acffad6beb351df26c3d690))
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# (c) Copyright 2019-2023 OLX
[package]
name = "dali"
version = "1.6.0"
version = "1.5.0"
authors = ["Augusto César Dias <augusto.dias@olx.com>"]
edition = "2021"

Expand Down

0 comments on commit 828244e

Please sign in to comment.