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 code #1

Merged
merged 2 commits into from
Jun 22, 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
50 changes: 50 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Check PR

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
branches:
- main

jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v1
with:
java-version: '11'
java-package: jdk

- id: bump
uses: zwaldowski/match-label-action@v1
with:
allowed: major,minor,patch

- uses: zwaldowski/semver-release-action@v2
with:
dry_run: true
bump: ${{ steps.bump.outputs.match }}
github_token: ${{ secrets.GITHUB_TOKEN }}

comment:
runs-on: ubuntu-latest
if: always()
steps:
- uses: technote-space/workflow-conclusion-action@v2
- name: Checkout
uses: actions/checkout@v1

- name: Comment PR
if: env.WORKFLOW_CONCLUSION == 'failure'
uses: thollander/actions-comment-pull-request@1.0.2
with:
message: "Please apply one of the following labels to the PR: 'patch', 'minor', 'major'. For more information see: https://github.com/FIWARE/endpoint-auth-service/CONTRIBUTING.md"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98 changes: 98 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Pre-Release

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
env:
REGISTRY: quay.io
REPOSITORY: wi_stefan

jobs:

generate-version:
runs-on: ubuntu-latest

outputs:
version: ${{ steps.out.outputs.version }}

steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v1
with:
java-version: '11'
java-package: jdk

- id: bump
uses: zwaldowski/match-label-action@v1
with:
allowed: major,minor,patch

- uses: zwaldowski/semver-release-action@v2
with:
dry_run: true
bump: ${{ steps.bump.outputs.match }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Get PR Number
id: pr_number
run: echo "::set-output name=nr::$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')"

- name: Set version output
id: out
run: echo "::set-output name=version::$(echo ${VERSION}-PRE-${{ steps.pr_number.outputs.nr }})"

# image build&push

ishare-jwt-helper:
needs: [ "generate-version" ]
runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v2

- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ishare-jwt-helper
tags: latest ${{ github.sha }} ${{needs.generate-version.outputs.version}}
dockerfiles: |
./
context: ./

- name: Push To quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

git-release:
needs:
- generate-version
- ishare-jwt-helper

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ needs.generate-version.outputs.version }}
prerelease: true
title: ${{ needs.generate-version.outputs.version }}
files: |
LICENSE
89 changes: 89 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Release

on:
push:
branches:
- main

env:
REGISTRY: quay.io
REPOSITORY: fiware

jobs:
generate-version:
runs-on: ubuntu-latest

outputs:
version: ${{ steps.out.outputs.version }}

steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v1
with:
java-version: '11'
java-package: jdk

- id: pr
uses: actions-ecosystem/action-get-merged-pull-request@v1.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- uses: zwaldowski/semver-release-action@v2
with:
dry_run: true
bump: ${{ steps.pr.outputs.labels }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Set version output
id: out
run: echo "::set-output name=version::$(echo ${VERSION})"

# image build&push

ishare-jwt-helper:
needs: [ "generate-version" ]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ishare-jwt-helper
tags: latest ${{ github.sha }} ${{needs.generate-version.outputs.version}}
dockerfiles: |
./
context: ./

- name: Push To quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

git-release:
needs:
- endpoint-configuration-service
- ishare-jwt-helper

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ needs.generate-version.outputs.version }}
prerelease: false
title: ${{ needs.generate-version.outputs.version }}
files: |
LICENSE
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM golang:1.18-alpine

WORKDIR /go/src/app
COPY ./ ./

RUN go get -d -v ./...
RUN go install -v ./...

CMD ["ishare-jwt-helper"]

Loading