Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

refact: refact PR/release github-actions #286

Merged
merged 4 commits into from
Feb 7, 2023
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
30 changes: 12 additions & 18 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ run-name: "${{ github.event.pull_request.title }} / [${{ github.actor }}] is tes

on:
pull_request:
# pull_request_target:
branches:
- main
- master
Expand All @@ -12,13 +11,21 @@ on:
- "**/*.md"
- "README.md"

permissions:
contents: write
packages: write
security-events: write
pull-requests: write

concurrency:
group: ${{ github.event.pull_request.head.repo.full_name }}-${{ github.head_ref }}/${{ github.ref }}
cancel-in-progress: true

env:
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
PULL_REQUEST_BRANCH: ${{ github.head_ref }}
PULL_REQUEST_HEAD: ${{ github.event.pull_request.head.sha }}
CONCURRENCY_GROUP: ${{ github.event.pull_request.head.repo.full_name }}-${{ github.head_ref }}/${{ github.ref }}
BRANCH: ${{ github.event.pull_request.head.ref }}
REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
REGISTRY: ghcr.io
Expand All @@ -41,8 +48,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ env.REPOSITORY }}
ref: ${{ env.BRANCH }}
ref: ${{ env.PULL_REQUEST_HEAD }}

- name: Read config
id: config
Expand Down Expand Up @@ -75,8 +81,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ env.REPOSITORY }}
ref: ${{ env.BRANCH }}
ref: ${{ env.PULL_REQUEST_HEAD }}

- name: Setup Golang
uses: actions/setup-go@v3
Expand Down Expand Up @@ -150,8 +155,6 @@ jobs:

release:
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- config
- build
Expand All @@ -161,8 +164,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ env.REPOSITORY }}
ref: ${{ env.BRANCH }}
ref: ${{ env.PULL_REQUEST_HEAD }}

- name: Set alpha version
id: version
Expand Down Expand Up @@ -194,10 +196,6 @@ jobs:

deploy:
name: deploy-[${{ matrix.name }}]
permissions:
contents: write
packages: write
pull-requests: write
runs-on: ubuntu-latest
strategy:
max-parallel: 1
Expand All @@ -211,8 +209,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ env.REPOSITORY }}
ref: ${{ env.BRANCH }}
ref: ${{ env.PULL_REQUEST_HEAD }}

- name: Setup instantclient cache
uses: actions/cache@v3
Expand Down Expand Up @@ -328,9 +325,6 @@ jobs:
comments:
runs-on: ubuntu-latest
if: ${{ needs.config.outputs.is-forked == 'false' }}
permissions:
contents: write
pull-requests: write
needs:
- config
- release
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

permissions:
contents: write
packages: write
security-events: write

env:
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
PULL_REQUEST_BRANCH: ${{ github.head_ref }}
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ ENV PKG_CONFIG_PATH /go/src/oracledb_exporter
RUN GOOS=linux GOARCH=amd64 go build -v -ldflags "-X main.Version=${VERSION} -s -w"

FROM ubuntu:22.10
LABEL authors="Seth Miller,Yannig Perré"
LABEL maintainer="Yannig Perré <[email protected]>"
LABEL org.opencontainers.image.authors="Seth Miller,Yannig Perré <[email protected]>"
LABEL org.opencontainers.image.description="Oracle DB Exporter"

ENV VERSION ${VERSION:-0.1.0}
ENV DEBIAN_FRONTEND=noninteractive
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ push-oraclelinux-image:
docker push $(IMAGE_ID)-oraclelinux
ifeq ("$(RELEASE)", "true")
docker push "$(IMAGE_NAME):oraclelinux"
docker push "$(IMAGE_ID)-oraclelinux_legacy-tablespace"
endif

sign-oraclelinux-image:
Expand All @@ -123,7 +124,8 @@ ubuntu-image: $(ORA_RPM)
push-ubuntu-image:
docker push $(IMAGE_ID)
ifeq ("$(RELEASE)", "true")
docker push $(IMAGE_ID_LATEST)
docker push "$(IMAGE_ID_LATEST)"
docker push "$(IMAGE_ID)_legacy-tablespace"
endif

sign-ubuntu-image:
Expand Down