Skip to content

Datasance Improvements #9

Datasance Improvements

Datasance Improvements #9

Workflow file for this run

name: CI
on:
push:
branches:
- main
- develop
- release*
tags: [v*]
paths-ignore:
- README.md
- CHANGELOG.md
- LICENSE
pull_request:
# Sequence of patterns matched against refs/heads
branches:
- main
- develop
- release*
paths-ignore:
- README.md
- CHANGELOG.md
- LICENSE
env:
IMAGE_NAME: 'port-manager'
jobs:
Port_Manager:
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
name: Port_Manager
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- run: go version
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50.1
args: --timeout=5m0s
- run: make build
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 0.0.0
- name: Set image tag
shell: bash
id: tags
run: |
if [[ ${{ github.ref_name }} =~ ^v.* ]] ; then
VERSION=${{ github.ref_name }}
echo "VERSION=${VERSION:1}" >> "${GITHUB_OUTPUT}"
else
VERSION=${{ steps.previoustag.outputs.tag }}
echo "VERSION=${VERSION:1}-${{ github.run_number }}" >> "${GITHUB_OUTPUT}"
fi
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.PAT }}
- name: Build and Push to ghcr
uses: docker/build-push-action@v3
id: build_push_ghcr
with:
file: Dockerfile
push: true
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Port-Manager
tags: |
ghcr.io/datasance/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.VERSION }}
ghcr.io/datasance/${{ env.IMAGE_NAME }}:latest
ghcr.io/datasance/${{ env.IMAGE_NAME }}:main
- run: mkdir -p ${{ github.workspace }}/artifact
- name: Create version artifact
run: echo ${{ steps.tags.outputs.VERSION }} > ${{ github.workspace }}/artifact/version.txt
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: env.IMAGE_NAME
path: ${{ github.workspace }}/artifact/version.txt