-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.yml
27 lines (22 loc) · 1.22 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
name: GitHub Actions
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
- name: Build the Docker image
run: docker build --file Dockerfile --tag docker.pkg.github.com/${{ github.repository }}/grafeas-oracle:${{ github.sha }} .
- name: Log in to registry
if: github.ref == 'refs/heads/master'
run: docker login docker.pkg.github.com -u ${{ github.actor }} -p ${{ secrets.package_registry_token }}
# this will cause an issue if we run two jobs simultaneously and the latest one finishes after the first
# we can get around this later by doing semver properly
- name: Tag the Docker image as latest
if: github.ref == 'refs/heads/master'
run: docker tag docker.pkg.github.com/${{ github.repository }}/grafeas-oracle:${{ github.sha }} docker.pkg.github.com/${{ github.repository }}/grafeas-oracle:latest
- name: Publish to GitHub Package Registry
if: github.ref == 'refs/heads/master'
run: docker push docker.pkg.github.com/${{ github.repository }}/grafeas-oracle:${{ github.sha }} && docker push docker.pkg.github.com/${{ github.repository }}/grafeas-oracle:latest